Package org.drools.core.rule
Class Accumulate
- java.lang.Object
-
- org.drools.core.rule.ConditionalElement
-
- org.drools.core.rule.Accumulate
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,PatternSource,RuleComponent,RuleConditionElement
- Direct Known Subclasses:
MultiAccumulate,SingleAccumulate
public abstract class Accumulate extends ConditionalElement implements PatternSource
A class to represent the Accumulate CE- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<Accumulate>clonedprotected Declaration[]innerDeclarationCacheprotected Declaration[]requiredDeclarationsprotected RuleConditionElementsource
-
Constructor Summary
Constructors Constructor Description Accumulate()Accumulate(RuleConditionElement source, Declaration[] requiredDeclarations)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Objectaccumulate(java.lang.Object workingMemoryContext, java.lang.Object context, Tuple match, InternalFactHandle handle, ReteEvaluator reteEvaluator)Executes the accumulate (action) code for the given fact handleabstract java.lang.Objectaccumulate(java.lang.Object workingMemoryContext, Tuple match, InternalFactHandle childHandle, AccumulateNode.GroupByContext groupByContext, TupleList<AccumulateNode.AccumulateContextEntry> tupleList, ReteEvaluator reteEvaluator)abstract Accumulateclone()Returns a clone from itselfabstract java.lang.ObjectcreateFunctionContext()abstract java.lang.ObjectcreateWorkingMemoryContext()abstract Accumulator[]getAccumulators()protected Declaration[]getInnerDeclarationCache()java.util.Map<java.lang.String,Declaration>getInnerDeclarations()Returns a Map of declarations that are visible inside this conditional elementjava.util.List<RuleConditionElement>getNestedElements()Returs a list of RuleConditionElement's that are nested inside the current elementjava.util.Map<java.lang.String,Declaration>getOuterDeclarations()Returns a Map of declarations that are visible outside this conditional element.Declaration[]getRequiredDeclarations()abstract java.lang.ObjectgetResult(java.lang.Object workingMemoryContext, java.lang.Object context, Tuple leftTuple, ReteEvaluator reteEvaluator)Gets the result of the accumulationRuleConditionElementgetSource()booleanhasRequiredDeclarations()abstract java.lang.Objectinit(java.lang.Object workingMemoryContext, java.lang.Object accContext, java.lang.Object funcContext, Tuple leftTuple, ReteEvaluator reteEvaluator)Executes the initialization block of codebooleanisGroupBy()abstract booleanisMultiFunction()booleanisPatternScopeDelimiter()Returns true in case this RuleConditionElement delimits a pattern visibility scope.voidreadExternal(java.io.ObjectInput in)protected voidregisterClone(Accumulate clone)abstract voidreplaceAccumulatorDeclaration(Declaration declaration, Declaration resolved)voidreplaceDeclaration(Declaration declaration, Declaration resolved)booleanrequiresLeftActivation()DeclarationresolveDeclaration(java.lang.String identifier)Resolves the given identifier in the current scope and returns the Declaration object for the declaration.abstract booleansupportsReverse()Returns true if this accumulate supports reverseabstract booleantryReverse(java.lang.Object workingMemoryContext, java.lang.Object context, Tuple leftTuple, InternalFactHandle handle, RightTuple rightParent, LeftTuple match, ReteEvaluator reteEvaluator)Executes the reverse (action) code for the given fact handlevoidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
source
protected RuleConditionElement source
-
requiredDeclarations
protected Declaration[] requiredDeclarations
-
innerDeclarationCache
protected Declaration[] innerDeclarationCache
-
cloned
protected java.util.List<Accumulate> cloned
-
-
Constructor Detail
-
Accumulate
public Accumulate()
-
Accumulate
public Accumulate(RuleConditionElement source, Declaration[] requiredDeclarations)
-
-
Method Detail
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
getAccumulators
public abstract Accumulator[] getAccumulators()
-
createFunctionContext
public abstract java.lang.Object createFunctionContext()
-
init
public abstract java.lang.Object init(java.lang.Object workingMemoryContext, java.lang.Object accContext, java.lang.Object funcContext, Tuple leftTuple, ReteEvaluator reteEvaluator)Executes the initialization block of code
-
accumulate
public abstract java.lang.Object accumulate(java.lang.Object workingMemoryContext, java.lang.Object context, Tuple match, InternalFactHandle handle, ReteEvaluator reteEvaluator)Executes the accumulate (action) code for the given fact handle
-
tryReverse
public abstract boolean tryReverse(java.lang.Object workingMemoryContext, java.lang.Object context, Tuple leftTuple, InternalFactHandle handle, RightTuple rightParent, LeftTuple match, ReteEvaluator reteEvaluator)Executes the reverse (action) code for the given fact handle
-
getResult
public abstract java.lang.Object getResult(java.lang.Object workingMemoryContext, java.lang.Object context, Tuple leftTuple, ReteEvaluator reteEvaluator)Gets the result of the accumulation
-
supportsReverse
public abstract boolean supportsReverse()
Returns true if this accumulate supports reverse
-
clone
public abstract Accumulate clone()
Description copied from interface:RuleConditionElementReturns a clone from itself- Specified by:
clonein interfaceRuleConditionElement- Specified by:
clonein classConditionalElement- Returns:
-
registerClone
protected void registerClone(Accumulate clone)
-
getSource
public RuleConditionElement getSource()
-
getInnerDeclarations
public java.util.Map<java.lang.String,Declaration> getInnerDeclarations()
Description copied from interface:RuleConditionElementReturns a Map of declarations that are visible inside this conditional element- Specified by:
getInnerDeclarationsin interfaceRuleConditionElement- Returns:
-
getOuterDeclarations
public java.util.Map<java.lang.String,Declaration> getOuterDeclarations()
Description copied from interface:RuleConditionElementReturns a Map of declarations that are visible outside this conditional element.- Specified by:
getOuterDeclarationsin interfaceRuleConditionElement- Returns:
-
resolveDeclaration
public Declaration resolveDeclaration(java.lang.String identifier)
Description copied from interface:RuleConditionElementResolves the given identifier in the current scope and returns the Declaration object for the declaration. Returns null if identifier can not be resolved.- Specified by:
resolveDeclarationin interfaceRuleConditionElement- Returns:
-
createWorkingMemoryContext
public abstract java.lang.Object createWorkingMemoryContext()
-
getNestedElements
public java.util.List<RuleConditionElement> getNestedElements()
Description copied from interface:RuleConditionElementReturs a list of RuleConditionElement's that are nested inside the current element- Specified by:
getNestedElementsin interfaceRuleConditionElement- Returns:
-
isPatternScopeDelimiter
public boolean isPatternScopeDelimiter()
Description copied from interface:RuleConditionElementReturns true in case this RuleConditionElement delimits a pattern visibility scope. For instance, AND CE is not a scope delimiter, while NOT CE is a scope delimiter- Specified by:
isPatternScopeDelimiterin interfaceRuleConditionElement- Returns:
-
isMultiFunction
public abstract boolean isMultiFunction()
-
replaceDeclaration
public void replaceDeclaration(Declaration declaration, Declaration resolved)
-
replaceAccumulatorDeclaration
public abstract void replaceAccumulatorDeclaration(Declaration declaration, Declaration resolved)
-
getInnerDeclarationCache
protected Declaration[] getInnerDeclarationCache()
-
getRequiredDeclarations
public Declaration[] getRequiredDeclarations()
-
hasRequiredDeclarations
public boolean hasRequiredDeclarations()
-
requiresLeftActivation
public boolean requiresLeftActivation()
- Specified by:
requiresLeftActivationin interfacePatternSource
-
isGroupBy
public boolean isGroupBy()
-
accumulate
public abstract java.lang.Object accumulate(java.lang.Object workingMemoryContext, Tuple match, InternalFactHandle childHandle, AccumulateNode.GroupByContext groupByContext, TupleList<AccumulateNode.AccumulateContextEntry> tupleList, ReteEvaluator reteEvaluator)
-
-