idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
7,800
private void objectTypeRow ( final int row , final int column , final String value , final int mergedColStart ) { if ( value . contains ( "$param" ) || value . contains ( "$1" ) ) { throw new DecisionTableParseException ( "It looks like you have snippets in the row that is " + "meant for object declarations." + " Pleas...
This is for handling a row where an object declaration may appear this is the row immediately above the snippets . It may be blank but there has to be a row here .
7,801
private static TokenRange tokenRange ( Token token ) { JavaToken javaToken = token . javaToken ; return new TokenRange ( javaToken , javaToken ) ; }
Create a TokenRange that spans exactly one token
7,802
static Comment createCommentFromToken ( Token token ) { String commentText = token . image ; if ( token . kind == JAVADOC_COMMENT ) { return new JavadocComment ( tokenRange ( token ) , commentText . substring ( 3 , commentText . length ( ) - 2 ) ) ; } else if ( token . kind == MULTI_LINE_COMMENT ) { return new BlockCom...
Since comments are completely captured in a single token including their delimiters deconstruct them here so we can turn them into nodes later on .
7,803
public final synchronized void removeEventListener ( final Class cls ) { for ( int listenerIndex = 0 ; listenerIndex < this . listeners . size ( ) ; ) { E listener = this . listeners . get ( listenerIndex ) ; if ( cls . isAssignableFrom ( listener . getClass ( ) ) ) { this . listeners . remove ( listenerIndex ) ; } els...
Removes all event listeners of the specified class . Note that this method needs to be synchonized because it performs two independent operations on the underlying list
7,804
public void makeReferences ( CellRow row , CellCol col , CellSqr sqr ) { this . cellRow = row ; this . cellCol = col ; this . cellSqr = sqr ; this . exCells = new HashSet < Cell > ( ) ; this . exCells . addAll ( this . cellRow . getCells ( ) ) ; this . exCells . addAll ( this . cellCol . getCells ( ) ) ; this . exCells...
Set references to all cell groups containing this cell .
7,805
public static String getUrl ( Object o ) { if ( o instanceof VerifierRule ) { VerifierRule rule = ( VerifierRule ) o ; return getRuleUrl ( UrlFactory . RULE_FOLDER , rule . getPath ( ) , rule . getName ( ) ) ; } return o . toString ( ) ; }
Finds a link to object if one exists .
7,806
public static Class < ? > loadClass ( String className , ClassLoader classLoader ) { Class cls = ( Class ) classes . get ( className ) ; if ( cls == null ) { try { cls = Class . forName ( className ) ; } catch ( Exception e ) { } if ( cls == null && classLoader != null ) { try { cls = classLoader . loadClass ( classNam...
This method will attempt to load the specified Class . It uses a syncrhonized HashMap to cache the reflection Class lookup .
7,807
public static Object instantiateObject ( String className , ClassLoader classLoader ) { Object object ; try { object = loadClass ( className , classLoader ) . newInstance ( ) ; } catch ( Throwable e ) { throw new RuntimeException ( "Unable to instantiate object for class '" + className + "'" , e ) ; } return object ; }
This method will attempt to create an instance of the specified Class . It uses a syncrhonized HashMap to cache the reflection Class lookup .
7,808
public static void addImportStylePatterns ( Map < String , Object > patterns , String str ) { if ( str == null || "" . equals ( str . trim ( ) ) ) { return ; } String [ ] items = str . split ( " " ) ; for ( String item : items ) { String qualifiedNamespace = item . substring ( 0 , item . lastIndexOf ( '.' ) ) . trim ( ...
Populates the import style pattern map from give comma delimited string
7,809
public static boolean isMatched ( Map < String , Object > patterns , String className ) { String qualifiedNamespace = className ; String name = className ; if ( className . indexOf ( '.' ) > 0 ) { qualifiedNamespace = className . substring ( 0 , className . lastIndexOf ( '.' ) ) . trim ( ) ; name = className . substrin...
Determines if a given full qualified class name matches any import style patterns .
7,810
public static String getPackage ( Class < ? > cls ) { java . lang . Package pkg = cls . isArray ( ) ? cls . getComponentType ( ) . getPackage ( ) : cls . getPackage ( ) ; if ( pkg == null ) { int dotPos ; int dolPos = cls . getName ( ) . indexOf ( '$' ) ; if ( dolPos > 0 ) { dotPos = cls . getName ( ) . substring ( 0 ,...
Extracts the package name from the given class object
7,811
public boolean add ( AuditLogEntry e ) { if ( filter == null ) { throw new IllegalStateException ( "AuditLogFilter has not been set. Please set before inserting entries." ) ; } if ( filter . accept ( e ) ) { entries . addFirst ( e ) ; return true ; } return false ; }
Add a new AuditLogEntry at the beginning of the list . This is different behaviour to a regular List but it prevents the need to sort entries in descending order .
7,812
public String getMessage ( ) { if ( this . cause == null ) { return super . getMessage ( ) + " Line number: " + this . lineNumber ; } else { return super . getMessage ( ) + " Line number: " + this . lineNumber + ". Caused by: " + this . cause . getMessage ( ) ; } }
This will print out a summary including the line number . It will also print out the cause message if applicable .
7,813
public static URL getURL ( String confName , ClassLoader classLoader , Class cls ) { URL url = null ; String userHome = System . getProperty ( "user.home" ) ; if ( userHome . endsWith ( "\\" ) || userHome . endsWith ( "/" ) ) { url = getURLForFile ( userHome + confName ) ; } else { url = getURLForFile ( userHome + "/" ...
Return the URL for a given conf file
7,814
public static URL getURLForFile ( String fileName ) { URL url = null ; if ( fileName != null ) { File file = new File ( fileName ) ; if ( file != null && file . exists ( ) ) { try { url = file . toURL ( ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( "file.toURL() failed for '" + file + "...
Return URL for given filename
7,815
public AnnotationDescr addAnnotation ( String name , String value ) { if ( this . annotations == null ) { this . annotations = new HashMap < String , AnnotationDescr > ( ) ; } else { AnnotationDescr existingAnnotation = annotations . get ( name ) ; if ( existingAnnotation != null ) { existingAnnotation . setDuplicated ...
Assigns a new annotation to this type with the respective name and value
7,816
public AnnotationDescr getAnnotation ( String name ) { return annotations == null ? null : annotations . get ( name ) ; }
Returns the annotation with the given name
7,817
private void initialize ( ) { addTransformationPair ( GroupElement . NOT , new NotOrTransformation ( ) ) ; addTransformationPair ( GroupElement . EXISTS , new ExistOrTransformation ( ) ) ; addTransformationPair ( GroupElement . AND , new AndOrTransformation ( ) ) ; }
sets up the parent - > child transformations map
7,818
protected void fixClonedDeclarations ( GroupElement and , Map < String , Class < ? > > globals ) { Stack < RuleConditionElement > contextStack = new Stack < RuleConditionElement > ( ) ; DeclarationScopeResolver resolver = new DeclarationScopeResolver ( globals , contextStack ) ; contextStack . push ( and ) ; processEle...
During the logic transformation we eventually clone CEs specially patterns and corresponding declarations . So now we need to fix any references to cloned declarations .
7,819
private void processTree ( final GroupElement ce , boolean [ ] result ) throws InvalidPatternException { boolean hasChildOr = false ; ce . pack ( ) ; for ( Object child : ce . getChildren ( ) . toArray ( ) ) { if ( child instanceof GroupElement ) { final GroupElement group = ( GroupElement ) child ; processTree ( group...
Traverses a Tree during the process it transforms Or nodes moving the upwards and it removes duplicate logic statement this does not include Not nodes .
7,820
public void run ( final StatusUpdate onStatus , final Command onCompletion ) { cancelExistingAnalysis ( ) ; if ( rechecks . isEmpty ( ) ) { if ( onCompletion != null ) { onCompletion . execute ( ) ; return ; } } checkRunner . run ( rechecks , onStatus , onCompletion ) ; rechecks . clear ( ) ; }
Run analysis with feedback
7,821
public static InternalKnowledgeBase newKnowledgeBase ( KieBaseConfiguration conf ) { return newKnowledgeBase ( UUID . randomUUID ( ) . toString ( ) , ( RuleBaseConfiguration ) conf ) ; }
Create a new KnowledgeBase using the given KnowledgeBaseConfiguration
7,822
public static InternalKnowledgeBase newKnowledgeBase ( String kbaseId , KieBaseConfiguration conf ) { return new KnowledgeBaseImpl ( kbaseId , ( RuleBaseConfiguration ) conf ) ; }
Create a new KnowledgeBase using the given KnowledgeBaseConfiguration and the given KnowledgeBase ID .
7,823
public void readLogicalDependency ( final InternalFactHandle handle , final Object object , final Object value , final Activation activation , final PropagationContext context , final RuleImpl rule , final ObjectTypeConf typeConf ) { addLogicalDependency ( handle , object , value , activation , context , rule , typeCon...
Adds a justification for the FactHandle to the justifiedMap .
7,824
private void enableTMS ( Object object , ObjectTypeConf conf ) { Iterator < InternalFactHandle > it = ( ( ClassAwareObjectStore ) ep . getObjectStore ( ) ) . iterateFactHandles ( getActualClass ( object ) ) ; while ( it . hasNext ( ) ) { InternalFactHandle handle = it . next ( ) ; if ( handle != null && handle . getEqu...
TMS will be automatically enabled when the first logical insert happens .
7,825
public void setJavaLanguageLevel ( final String languageLevel ) { if ( Arrays . binarySearch ( LANGUAGE_LEVELS , languageLevel ) < 0 ) { throw new RuntimeException ( "value '" + languageLevel + "' is not a valid language level" ) ; } this . languageLevel = languageLevel ; }
You cannot set language level below 1 . 5 as we need static imports 1 . 5 is now the default .
7,826
public void setCompiler ( final CompilerType compiler ) { if ( compiler == CompilerType . ECLIPSE ) { try { Class . forName ( "org.eclipse.jdt.internal.compiler.Compiler" , true , this . conf . getClassLoader ( ) ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( "The Eclipse JDT Core jar is not in...
Set the compiler to be used when building the rules semantic code blocks . This overrides the default and even what was set as a system property .
7,827
private CompilerType getDefaultCompiler ( ) { try { final String prop = this . conf . getChainedProperties ( ) . getProperty ( JAVA_COMPILER_PROPERTY , "ECLIPSE" ) ; if ( prop . equals ( "NATIVE" ) ) { return CompilerType . NATIVE ; } else if ( prop . equals ( "ECLIPSE" ) ) { return CompilerType . ECLIPSE ; } else if (...
This will attempt to read the System property to work out what default to set . This should only be done once when the class is loaded . After that point you will have to programmatically override it .
7,828
private FieldIndex registerFieldIndex ( final int index , final InternalReadAccessor fieldExtractor ) { FieldIndex fieldIndex = null ; if ( this . hashedFieldIndexes == null ) { this . hashedFieldIndexes = new LinkedList < FieldIndex > ( ) ; fieldIndex = new FieldIndex ( index , fieldExtractor ) ; this . hashedFieldInd...
Returns a FieldIndex which Keeps a count on how many times a particular field is used with an equality check in the sinks .
7,829
protected void doPropagateAssertObject ( InternalFactHandle factHandle , PropagationContext context , InternalWorkingMemory workingMemory , ObjectSink sink ) { sink . assertObject ( factHandle , context , workingMemory ) ; }
This is a Hook method for subclasses to override . Please keep it protected unless you know what you are doing .
7,830
public FEELFnResult < Object > evaluate ( EvaluationContext ctx , Object [ ] params ) { if ( decisionRules . isEmpty ( ) ) { return FEELFnResult . ofError ( new FEELEventBase ( Severity . WARN , "Decision table is empty" , null ) ) ; } Object [ ] actualInputs = resolveActualInputs ( ctx , feel ) ; Either < FEELEvent , ...
Evaluates this decision table returning the result
7,831
private Either < FEELEvent , Object > actualInputsMatchInputValues ( EvaluationContext ctx , Object [ ] params ) { for ( int i = 0 ; i < params . length ; i ++ ) { final DTInputClause input = inputs . get ( i ) ; if ( input . getInputValues ( ) != null && ! input . getInputValues ( ) . isEmpty ( ) ) { final Object para...
If valid input values are defined check that all parameters match the respective valid inputs
7,832
private List < DTDecisionRule > findMatches ( EvaluationContext ctx , Object [ ] params ) { List < DTDecisionRule > matchingDecisionRules = new ArrayList < > ( ) ; for ( DTDecisionRule decisionRule : decisionRules ) { if ( matches ( ctx , params , decisionRule ) ) { matchingDecisionRules . add ( decisionRule ) ; } } ct...
Finds all rules that match a given set of parameters
7,833
private boolean matches ( EvaluationContext ctx , Object [ ] params , DTDecisionRule rule ) { for ( int i = 0 ; i < params . length ; i ++ ) { CompiledExpression compiledInput = inputs . get ( i ) . getCompiledInput ( ) ; if ( compiledInput instanceof CompiledFEELExpression ) { ctx . setValue ( "?" , ( ( CompiledFEELEx...
Checks if the parameters match a single rule
7,834
private boolean satisfies ( EvaluationContext ctx , Object param , UnaryTest test ) { return test . apply ( ctx , param ) ; }
Checks that a given parameter matches a single cell test
7,835
private Object defaultToOutput ( EvaluationContext ctx , FEEL feel ) { Map < String , Object > values = ctx . getAllValues ( ) ; if ( outputs . size ( ) == 1 ) { Object value = feel . evaluate ( outputs . get ( 0 ) . getDefaultValue ( ) , values ) ; return value ; } else { return IntStream . range ( 0 , outputs . size ...
No hits matched for the DT so calculate result based on default outputs
7,836
public void marshalMarshall ( Object o , OutputStream out ) { try { XStream xStream = newXStream ( ) ; out . write ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . getBytes ( ) ) ; OutputStreamWriter ows = new OutputStreamWriter ( out , "UTF-8" ) ; xStream . toXML ( o , ows ) ; } catch ( Exception e ) { e . printStac...
Unnecessary as was a tentative UTF - 8 preamble output but still not working .
7,837
public static String formatXml ( String xml ) { try { Transformer serializer = SAXTransformerFactory . newInstance ( ) . newTransformer ( ) ; serializer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; serializer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "2" ) ; Source xmlSource = new SAX...
Unnecessary as the stax driver custom anon as static definition is embedding the indentation .
7,838
public void setDMNLabel ( org . kie . dmn . model . api . dmndi . DMNLabel value ) { this . dmnLabel = value ; }
Sets the value of the dmnLabel property .
7,839
public ClassDefinition generateDeclaredBean ( AbstractClassTypeDeclarationDescr typeDescr , TypeDeclaration type , PackageRegistry pkgRegistry , List < TypeDefinition > unresolvedTypeDefinitions , Map < String , AbstractClassTypeDeclarationDescr > unprocesseableDescrs ) { ClassDefinition def = createClassDefinition ( t...
Generates a bean and adds it to the composite class loader that everything is using .
7,840
public void writeToDisk ( ) { if ( ! initialized ) { initializeLog ( ) ; } Writer writer = null ; try { FileOutputStream fileOut = new FileOutputStream ( this . fileName + ( this . nbOfFile == 0 ? ".log" : this . nbOfFile + ".log" ) , true ) ; writer = new OutputStreamWriter ( fileOut , IoUtils . UTF8_CHARSET ) ; final...
All events in the log are written to file . The log is automatically cleared afterwards .
7,841
public static Object and ( Object left , Object right , EvaluationContext ctx ) { Boolean l = EvalHelper . getBooleanOrNull ( left ) ; Boolean r = EvalHelper . getBooleanOrNull ( right ) ; if ( ( l == null && r == null ) || ( l == null && r == true ) || ( r == null && l == true ) ) { return null ; } else if ( l == null...
Implements the ternary logic AND operation
7,842
public List < KnowledgeBuilderResult > addResults ( List < KnowledgeBuilderResult > list ) { if ( list == null ) { list = new ArrayList < KnowledgeBuilderResult > ( ) ; } for ( Dialect dialect : map . values ( ) ) { List < KnowledgeBuilderResult > results = dialect . getResults ( ) ; if ( results != null ) { for ( Know...
Add all registered Dialect results to the provided List .
7,843
public void addImport ( ImportDescr importDescr ) { for ( Dialect dialect : this . map . values ( ) ) { dialect . addImport ( importDescr ) ; } }
Iterates all registered dialects informing them of an import added to the PackageBuilder
7,844
public void addStaticImport ( ImportDescr importDescr ) { for ( Dialect dialect : this . map . values ( ) ) { dialect . addStaticImport ( importDescr ) ; } }
Iterates all registered dialects informing them of a static imports added to the PackageBuilder
7,845
public void deployArtifact ( AFReleaseId releaseId , InternalKieModule kieModule , File pomfile ) { RemoteRepository repository = getRemoteRepositoryFromDistributionManagement ( pomfile ) ; if ( repository == null ) { log . warn ( "No Distribution Management configured: unknown repository" ) ; return ; } deployArtifact...
Deploys the kjar in the given kieModule on the remote repository defined in the distributionManagement tag of the provided pom file . If the pom file doesn t define a distributionManagement no deployment will be performed and a warning message will be logged .
7,846
public void deployArtifact ( RemoteRepository repository , AFReleaseId releaseId , InternalKieModule kieModule , File pomfile ) { File jarFile = bytesToFile ( releaseId , kieModule . getBytes ( ) , ".jar" ) ; deployArtifact ( repository , releaseId , jarFile , pomfile ) ; }
Deploys the kjar in the given kieModule on a remote repository .
7,847
public void installArtifact ( AFReleaseId releaseId , InternalKieModule kieModule , File pomfile ) { File jarFile = bytesToFile ( releaseId , kieModule . getBytes ( ) , ".jar" ) ; installArtifact ( releaseId , jarFile , pomfile ) ; }
Installs the kjar in the given kieModule into the local repository .
7,848
@ Generated ( "com.github.javaparser.generator.core.node.PropertyGenerator" ) public NullSafeFieldAccessExpr setScope ( final Expression scope ) { assertNotNull ( scope ) ; if ( scope == this . scope ) { return ( NullSafeFieldAccessExpr ) this ; } notifyPropertyChange ( ObservableProperty . SCOPE , this . scope , scope...
Sets the scope
7,849
@ Generated ( "com.github.javaparser.generator.core.node.PropertyGenerator" ) public NullSafeFieldAccessExpr setTypeArguments ( final NodeList < Type > typeArguments ) { if ( typeArguments == this . typeArguments ) { return ( NullSafeFieldAccessExpr ) this ; } notifyPropertyChange ( ObservableProperty . TYPE_ARGUMENTS ...
Sets the type arguments
7,850
public void compileNode ( DecisionService ds , DMNCompilerImpl compiler , DMNModelImpl model ) { DMNType type = null ; if ( ds . getVariable ( ) == null ) { DMNCompilerHelper . reportMissingVariable ( model , ds , ds , Msg . MISSING_VARIABLE_FOR_DS ) ; return ; } DMNCompilerHelper . checkVariableName ( model , ds , ds ...
backport of DMN v1 . 1
7,851
private static String inputQualifiedNamePrefix ( DMNNode input , DMNModelImpl model ) { if ( input . getModelNamespace ( ) . equals ( model . getNamespace ( ) ) ) { return null ; } else { Optional < String > importAlias = model . getImportAliasFor ( input . getModelNamespace ( ) , input . getModelName ( ) ) ; if ( ! im...
DMN v1 . 2 specification chapter 10 . 4 Execution Semantics of Decision Services The qualified name of an element named E that is defined in the same decision model as S is simply E . Otherwise the qualified name is I . E where I is the name of the import element that refers to the model where E is defined .
7,852
public GuidedDecisionTable52 upgrade ( GuidedDecisionTable52 source ) { final GuidedDecisionTable52 destination = source ; final int iRowNumberColumnIndex = 0 ; Integer iSalienceColumnIndex = null ; Integer iDurationColumnIndex = null ; List < BaseColumn > allColumns = destination . getExpandedColumns ( ) ; for ( int i...
Convert the data - types in the Decision Table model
7,853
public static void addRule ( TerminalNode tn , Collection < InternalWorkingMemory > wms , InternalKnowledgeBase kBase ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Adding Rule {}" , tn . getRule ( ) . getName ( ) ) ; } boolean hasProtos = kBase . hasSegmentPrototypes ( ) ; boolean hasWms = ! wms . isEmpty ( ) ; ...
This method is called after the rule nodes have been added to the network For add tuples are processed after the segments and pmems have been adjusted
7,854
public static void removeRule ( TerminalNode tn , Collection < InternalWorkingMemory > wms , InternalKnowledgeBase kBase ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Removing Rule {}" , tn . getRule ( ) . getName ( ) ) ; } boolean hasProtos = kBase . hasSegmentPrototypes ( ) ; boolean hasWms = ! wms . isEmpty (...
This method is called before the rule nodes are removed from the network . For remove tuples are processed before the segments and pmems have been adjusted
7,855
private static LeftTuple insertPeerLeftTuple ( LeftTuple lt , LeftTupleSinkNode node , InternalWorkingMemory wm ) { LeftInputAdapterNode . LiaNodeMemory liaMem = null ; if ( node . getLeftTupleSource ( ) . getType ( ) == NodeTypeEnums . LeftInputAdapterNode ) { liaMem = wm . getNodeMemory ( ( ( LeftInputAdapterNode ) n...
Create all missing peers
7,856
public void addAlphaConstraint ( AlphaNodeFieldConstraint constraint ) { if ( constraint != null ) { AlphaNodeFieldConstraint [ ] tmp = this . alphaConstraints ; this . alphaConstraints = new AlphaNodeFieldConstraint [ tmp . length + 1 ] ; System . arraycopy ( tmp , 0 , this . alphaConstraints , 0 , tmp . length ) ; th...
Adds an alpha constraint to the multi field OR constraint
7,857
public void addBetaConstraint ( BetaNodeFieldConstraint constraint ) { if ( constraint != null ) { BetaNodeFieldConstraint [ ] tmp = this . betaConstraints ; this . betaConstraints = new BetaNodeFieldConstraint [ tmp . length + 1 ] ; System . arraycopy ( tmp , 0 , this . betaConstraints , 0 , tmp . length ) ; this . be...
Adds a beta constraint to this multi field OR constraint
7,858
public void addConstraint ( Constraint constraint ) { if ( ConstraintType . ALPHA . equals ( constraint . getType ( ) ) ) { this . addAlphaConstraint ( ( AlphaNodeFieldConstraint ) constraint ) ; } else if ( ConstraintType . BETA . equals ( constraint . getType ( ) ) ) { this . addBetaConstraint ( ( BetaNodeFieldConstr...
Adds a constraint too all lists it belongs to by checking for its type
7,859
protected void updateRequiredDeclarations ( Constraint constraint ) { Declaration [ ] decs = constraint . getRequiredDeclarations ( ) ; if ( decs != null && decs . length > 0 ) { for ( Declaration dec1 : decs ) { Declaration dec = dec1 ; for ( Declaration requiredDeclaration : this . requiredDeclarations ) { if ( dec ....
Updades the cached required declaration array
7,860
public FunctionKind getKind ( ) { String kindValueOnV11 = this . getAdditionalAttributes ( ) . get ( KIND_QNAME ) ; if ( kindValueOnV11 == null || kindValueOnV11 . isEmpty ( ) ) { return FunctionKind . FEEL ; } else { switch ( kindValueOnV11 ) { case "F" : return FunctionKind . FEEL ; case "J" : return FunctionKind . J...
Align to DMN v1 . 2
7,861
public RiaNodeMemory createMemory ( final RuleBaseConfiguration config , InternalWorkingMemory wm ) { RiaNodeMemory rianMem = new RiaNodeMemory ( ) ; RiaPathMemory pmem = new RiaPathMemory ( this , wm ) ; PathMemSpec pathMemSpec = getPathMemSpec ( ) ; pmem . setAllLinkedMaskTest ( pathMemSpec . allLinkedTestMask ) ; pm...
Creates and return the node memory
7,862
public Object get ( final Declaration declaration ) { return declaration . getValue ( ( InternalWorkingMemory ) workingMemory , getObject ( getFactHandle ( declaration ) ) ) ; }
Return the Object for the given Declaration .
7,863
public FactHandle [ ] getFactHandles ( ) { int size = size ( ) ; FactHandle [ ] subArray = new FactHandle [ size ] ; System . arraycopy ( this . row . getHandles ( ) , 1 , subArray , 0 , size ) ; return subArray ; }
Return the FactHandles for the Tuple .
7,864
@ SuppressWarnings ( "unchecked" ) public void addEvaluatorDefinition ( String className ) { try { Class < EvaluatorDefinition > defClass = ( Class < EvaluatorDefinition > ) this . classloader . loadClass ( className ) ; EvaluatorDefinition def = defClass . newInstance ( ) ; addEvaluatorDefinition ( def ) ; } catch ( C...
Adds an evaluator definition class to the registry using the evaluator class name . The class will be loaded and the corresponting evaluator ID will be added to the registry . In case there exists an implementation for that ID already the new implementation will replace the previous one .
7,865
public void addEvaluatorDefinition ( EvaluatorDefinition def ) { for ( String id : def . getEvaluatorIds ( ) ) { this . evaluators . put ( id , def ) ; } }
Adds an evaluator definition class to the registry . In case there exists an implementation for that evaluator ID already the new implementation will replace the previous one .
7,866
public GuidedDecisionTable52 upgrade ( GuidedDecisionTable52 source ) { final GuidedDecisionTable52 destination = source ; for ( BaseColumn column : source . getExpandedColumns ( ) ) { DTColumnConfig52 dtColumn = null ; if ( column instanceof MetadataCol52 ) { dtColumn = ( DTColumnConfig52 ) column ; } else if ( column...
Convert the Default Values in the Decision Table model
7,867
public List < DMNDiagram > getDMNDiagram ( ) { if ( dmnDiagram == null ) { dmnDiagram = new ArrayList < DMNDiagram > ( ) ; } return this . dmnDiagram ; }
Gets the value of the dmnDiagram property .
7,868
public List < DMNStyle > getDMNStyle ( ) { if ( dmnStyle == null ) { dmnStyle = new ArrayList < DMNStyle > ( ) ; } return this . dmnStyle ; }
Gets the value of the dmnStyle property .
7,869
public static String getUniqueLegalName ( final String packageName , final String name , final int seed , final String ext , final String prefix , final ResourceReader src ) { final String newName = prefix + "_" + normalizeRuleName ( name ) ; if ( ext . equals ( "java" ) ) { return newName + Math . abs ( seed ) ; } fin...
Takes a given name and makes sure that its legal and doesn t already exist . If the file exists it increases counter appender untill it is unique .
7,870
public EvaluationContextImpl newEvaluationContext ( Collection < FEELEventListener > listeners , Map < String , Object > inputVariables ) { return newEvaluationContext ( this . classLoader , listeners , inputVariables ) ; }
Creates a new EvaluationContext using this FEEL instance classloader and the supplied parameters listeners and inputVariables
7,871
public EvaluationContextImpl newEvaluationContext ( ClassLoader cl , Collection < FEELEventListener > listeners , Map < String , Object > inputVariables ) { FEELEventListenersManager eventsManager = getEventsManager ( listeners ) ; EvaluationContextImpl ctx = new EvaluationContextImpl ( cl , eventsManager , inputVariab...
Creates a new EvaluationContext with the supplied classloader and the supplied parameters listeners and inputVariables
7,872
public Memory getNodeMemory ( MemoryFactory node , InternalWorkingMemory wm ) { if ( node . getMemoryId ( ) >= this . memories . length ( ) ) { resize ( node ) ; } Memory memory = this . memories . get ( node . getMemoryId ( ) ) ; if ( memory == null ) { memory = createNodeMemory ( node , wm ) ; } return memory ; }
The implementation tries to delay locking as much as possible by running some potentially unsafe operations out of the critical session . In case it fails the checks it will move into the critical sessions and re - check everything before effectively doing any change on data structures .
7,873
private Memory createNodeMemory ( MemoryFactory node , InternalWorkingMemory wm ) { try { this . lock . lock ( ) ; Memory memory = this . memories . get ( node . getMemoryId ( ) ) ; if ( memory == null ) { memory = node . createMemory ( this . kBase . getConfiguration ( ) , wm ) ; if ( ! this . memories . compareAndSet...
Checks if a memory does not exists for the given node and creates it .
7,874
public void setDMNDecisionServiceDividerLine ( org . kie . dmn . model . api . dmndi . DMNDecisionServiceDividerLine value ) { this . dmnDecisionServiceDividerLine = value ; }
Sets the value of the dmnDecisionServiceDividerLine property .
7,875
public boolean evaluate ( InternalWorkingMemory workingMemory , Object left , Object right ) { Object leftValue = leftTimestamp != null ? leftTimestamp : left ; Object rightValue = rightTimestamp != null ? rightTimestamp : right ; return rightLiteral ? evaluator . evaluate ( workingMemory , new ConstantValueReader ( le...
This method is called when operators are rewritten as function calls . For instance
7,876
public FactPattern getLHSBoundFact ( final String var ) { if ( this . lhs == null ) { return null ; } for ( int i = 0 ; i < this . lhs . length ; i ++ ) { IPattern pat = this . lhs [ i ] ; if ( pat instanceof FromCompositeFactPattern ) { pat = ( ( FromCompositeFactPattern ) pat ) . getFactPattern ( ) ; } if ( pat insta...
This will return the FactPattern that a variable is bound Eto .
7,877
public SingleFieldConstraint getLHSBoundField ( final String var ) { if ( this . lhs == null ) { return null ; } for ( int i = 0 ; i < this . lhs . length ; i ++ ) { IPattern pat = this . lhs [ i ] ; SingleFieldConstraint fieldConstraint = getLHSBoundField ( pat , var ) ; if ( fieldConstraint != null ) { return fieldCo...
This will return the FieldConstraint that a variable is bound to .
7,878
public String getLHSBindingType ( final String var ) { if ( this . lhs == null ) { return null ; } for ( int i = 0 ; i < this . lhs . length ; i ++ ) { String type = getLHSBindingType ( this . lhs [ i ] , var ) ; if ( type != null ) { return type ; } } return null ; }
Get the data - type associated with the binding
7,879
public ActionInsertFact getRHSBoundFact ( final String var ) { if ( this . rhs == null ) { return null ; } for ( int i = 0 ; i < this . rhs . length ; i ++ ) { if ( this . rhs [ i ] instanceof ActionInsertFact ) { final ActionInsertFact p = ( ActionInsertFact ) this . rhs [ i ] ; if ( p . getBoundName ( ) != null && va...
This will return the ActionInsertFact that a variable is bound to .
7,880
public FactPattern getLHSParentFactPatternForBinding ( final String var ) { if ( this . lhs == null ) { return null ; } for ( int i = 0 ; i < this . lhs . length ; i ++ ) { IPattern pat = this . lhs [ i ] ; if ( pat instanceof FromCompositeFactPattern ) { pat = ( ( FromCompositeFactPattern ) pat ) . getFactPattern ( ) ...
This will return the FactPattern that a variable is bound to . If the variable is bound to a FieldConstraint the parent FactPattern will be returned .
7,881
public List < String > getAllRHSVariables ( ) { List < String > result = new ArrayList < String > ( ) ; for ( int i = 0 ; i < this . rhs . length ; i ++ ) { IAction pat = this . rhs [ i ] ; if ( pat instanceof ActionInsertFact ) { ActionInsertFact fact = ( ActionInsertFact ) pat ; if ( fact . isBound ( ) ) { result . a...
This will get a list of all RHS bound variables .
7,882
public RuleMetadata getMetaData ( String attributeName ) { if ( metadataList != null && attributeName != null ) { for ( int i = 0 ; i < metadataList . length ; i ++ ) { if ( attributeName . equals ( metadataList [ i ] . getAttributeName ( ) ) ) { return metadataList [ i ] ; } } } return null ; }
Locate metadata element
7,883
public boolean updateMetadata ( final RuleMetadata target ) { RuleMetadata metaData = getMetaData ( target . getAttributeName ( ) ) ; if ( metaData != null ) { metaData . setValue ( target . getValue ( ) ) ; return true ; } addMetadata ( target ) ; return false ; }
Update metaData element if it exists or add it otherwise
7,884
public boolean hasDSLSentences ( ) { if ( this . lhs != null ) { for ( IPattern pattern : this . lhs ) { if ( pattern instanceof DSLSentence ) { return true ; } } } if ( this . rhs != null ) { for ( IAction action : this . rhs ) { if ( action instanceof DSLSentence ) { return true ; } } } return false ; }
Returns true if any DSLSentences are used .
7,885
public DTCellValue52 cloneDefaultValueCell ( ) { DTCellValue52 cloned = new DTCellValue52 ( ) ; cloned . valueBoolean = valueBoolean ; cloned . valueDate = valueDate ; cloned . valueNumeric = valueNumeric ; cloned . valueString = valueString ; cloned . dataType = dataType ; return cloned ; }
Clones this default value instance .
7,886
public WindowMemory createMemory ( final RuleBaseConfiguration config , InternalWorkingMemory wm ) { WindowMemory memory = new WindowMemory ( ) ; memory . behaviorContext = this . behavior . createBehaviorContext ( ) ; return memory ; }
Creates the WindowNode s memory .
7,887
private void moveRowsBasedOnPriority ( ) { for ( RowNumber myNumber : overs . keySet ( ) ) { Over over = overs . get ( myNumber ) ; int newIndex = rowOrder . indexOf ( new RowNumber ( over . getOver ( ) ) ) ; rowOrder . remove ( myNumber ) ; rowOrder . add ( newIndex , myNumber ) ; } }
Move rows on top of the row it has priority over .
7,888
private void initOpenMBeanInfo ( ) { OpenMBeanAttributeInfoSupport [ ] attributes = new OpenMBeanAttributeInfoSupport [ 4 ] ; OpenMBeanConstructorInfoSupport [ ] constructors = new OpenMBeanConstructorInfoSupport [ 1 ] ; OpenMBeanOperationInfoSupport [ ] operations = new OpenMBeanOperationInfoSupport [ 2 ] ; MBeanNotif...
Initialize the open mbean metadata
7,889
public String interpolate ( ) { getValues ( ) ; if ( definition == null ) { return "" ; } int variableStart = definition . indexOf ( "{" ) ; if ( variableStart < 0 ) { return definition ; } int index = 0 ; int variableEnd = 0 ; StringBuilder sb = new StringBuilder ( ) ; while ( variableStart >= 0 ) { sb . append ( defi...
This will strip off any { stuff substituting values accordingly
7,890
public DSLSentence copy ( ) { final DSLSentence copy = new DSLSentence ( ) ; copy . drl = getDrl ( ) ; copy . definition = getDefinition ( ) ; copy . values = mapCopy ( getValues ( ) ) ; return copy ; }
This is used by the GUI when adding a sentence to LHS or RHS .
7,891
private void parseSentence ( ) { if ( sentence == null ) { return ; } definition = sentence ; values = new ArrayList < DSLVariableValue > ( ) ; sentence = null ; int variableStart = definition . indexOf ( "{" ) ; while ( variableStart >= 0 ) { int variableEnd = getIndexForEndOfVariable ( definition , variableStart ) ; ...
to differentiate value from data - type from restriction
7,892
private void parseDefinition ( ) { values = new ArrayList < DSLVariableValue > ( ) ; if ( getDefinition ( ) == null ) { return ; } int variableStart = definition . indexOf ( "{" ) ; while ( variableStart >= 0 ) { int variableEnd = getIndexForEndOfVariable ( definition , variableStart ) ; String variable = definition . ...
Build the Values from the Definition .
7,893
private void addPackage ( Resource resource ) throws DroolsParserException , IOException { if ( pmmlCompiler != null ) { if ( pmmlCompiler . getResults ( ) . isEmpty ( ) ) { addPMMLPojos ( pmmlCompiler , resource ) ; if ( pmmlCompiler . getResults ( ) . isEmpty ( ) ) { List < PackageDescr > packages = getPackageDescrs ...
This method does the work of calling the PMML compiler and then assembling the results into packages that are added to the KnowledgeBuilder
7,894
private List < PackageDescr > getPackageDescrs ( Resource resource ) throws DroolsParserException , IOException { List < PMMLResource > resources = pmmlCompiler . precompile ( resource . getInputStream ( ) , null , null ) ; if ( resources != null && ! resources . isEmpty ( ) ) { return generatedResourcesToPackageDescr ...
This method calls the PMML compiler to get PMMLResource objects which are used to create one or more PackageDescr objects
7,895
private RuleModel updateMethodCall ( RuleModel model ) { for ( int i = 0 ; i < model . rhs . length ; i ++ ) { if ( model . rhs [ i ] instanceof ActionCallMethod ) { ActionCallMethod action = ( ActionCallMethod ) model . rhs [ i ] ; if ( action . getMethodName ( ) == null || "" . equals ( action . getMethodName ( ) ) )...
before that needs to be updated .
7,896
private static boolean isValidChar ( char c ) { if ( c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' ) { return true ; } return c != ' ' && c != '\u00A0' && ! Character . isWhitespace ( c ) && ! Character . isWhitespace ( c ) ; }
This method defines what characters are valid for the output of normalizeVariableName . Spaces and control characters are invalid . There is a fast - path for well known characters
7,897
public static Method getGenericAccessor ( Class < ? > clazz , String field ) { LOG . trace ( "getGenericAccessor({}, {})" , clazz , field ) ; String accessorQualifiedName = new StringBuilder ( clazz . getCanonicalName ( ) ) . append ( "." ) . append ( field ) . toString ( ) ; return accessorCache . computeIfAbsent ( ac...
FEEL annotated or else Java accessor .
7,898
public static Method getAccessor ( Class < ? > clazz , String field ) { LOG . trace ( "getAccessor({}, {})" , clazz , field ) ; try { return clazz . getMethod ( "get" + ucFirst ( field ) ) ; } catch ( NoSuchMethodException e ) { try { return clazz . getMethod ( field ) ; } catch ( NoSuchMethodException e1 ) { try { ret...
JavaBean - spec compliant accessor .
7,899
public static Boolean isEqual ( Object left , Object right , EvaluationContext ctx ) { if ( left == null || right == null ) { return left == right ; } if ( left instanceof Collection && ! ( right instanceof Collection ) && ( ( Collection ) left ) . size ( ) == 1 ) { left = ( ( Collection ) left ) . toArray ( ) [ 0 ] ; ...
Compares left and right for equality applying FEEL semantics to specific data types