Class JavaAccumulatorFunctionExecutor
- java.lang.Object
-
- org.drools.core.base.accumulators.JavaAccumulatorFunctionExecutor
-
- All Implemented Interfaces:
Externalizable,Serializable,Accumulator,Invoker,Wireable,RuleComponent
public class JavaAccumulatorFunctionExecutor extends Object implements Accumulator, Externalizable, Wireable
A Java accumulator function executor implementation- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.drools.core.rule.accessor.Wireable
Wireable.Immutable
-
-
Constructor Summary
Constructors Constructor Description JavaAccumulatorFunctionExecutor()JavaAccumulatorFunctionExecutor(org.kie.api.runtime.rule.AccumulateFunction function)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectaccumulate(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Declaration[] declarations, Declaration[] innerDeclarations, ReteEvaluator reteEvaluator)Executes the accumulate (action) code for the given fact handleObjectcreateContext()Creates the context object for an accumulator session.ObjectcreateWorkingMemoryContext()Creates and return a context object for each working memory instancebooleanequals(Object o)ReturnValueExpressiongetExpression()ObjectgetResult(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, ReteEvaluator reteEvaluator)Gets the result of the accummulationinthashCode()Objectinit(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, ReteEvaluator reteEvaluator)Executes the initialization block of codevoidreadExternal(ObjectInput in)voidsetExpression(ReturnValueExpression expression)booleansupportsReverse()Returns true if this accumulator supports operation reversalbooleantryReverse(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Object value, Declaration[] declarations, Declaration[] innerDeclarations, ReteEvaluator reteEvaluator)Reverses the accumulate action for the given fact handlevoidwire(Object object)voidwriteExternal(ObjectOutput out)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drools.core.rule.accessor.Accumulator
getRequiredDeclarations, replaceDeclaration
-
Methods inherited from interface org.drools.core.rule.accessor.Invoker
wrapsCompiledInvoker
-
-
-
-
Method Detail
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
createContext
public Object createContext()
Description copied from interface:AccumulatorCreates the context object for an accumulator session. The context is passed as a parameter to every subsequent accumulator method call in the same session.- Specified by:
createContextin interfaceAccumulator- Returns:
-
init
public Object init(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, ReteEvaluator reteEvaluator)
Description copied from interface:AccumulatorExecutes the initialization block of code- Specified by:
initin interfaceAccumulatorleftTuple- tuple causing the rule firedeclarations- previous declarations
-
accumulate
public Object accumulate(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Declaration[] declarations, Declaration[] innerDeclarations, ReteEvaluator reteEvaluator)
Description copied from interface:AccumulatorExecutes the accumulate (action) code for the given fact handle- Specified by:
accumulatein interfaceAccumulator
-
tryReverse
public boolean tryReverse(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Object value, Declaration[] declarations, Declaration[] innerDeclarations, ReteEvaluator reteEvaluator)
Description copied from interface:AccumulatorReverses the accumulate action for the given fact handle- Specified by:
tryReversein interfaceAccumulator
-
getResult
public Object getResult(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, ReteEvaluator reteEvaluator)
Description copied from interface:AccumulatorGets the result of the accummulation- Specified by:
getResultin interfaceAccumulator- Returns:
-
supportsReverse
public boolean supportsReverse()
Description copied from interface:AccumulatorReturns true if this accumulator supports operation reversal- Specified by:
supportsReversein interfaceAccumulator- Returns:
-
getExpression
public ReturnValueExpression getExpression()
-
setExpression
public void setExpression(ReturnValueExpression expression)
-
createWorkingMemoryContext
public Object createWorkingMemoryContext()
Description copied from interface:AccumulatorCreates and return a context object for each working memory instance- Specified by:
createWorkingMemoryContextin interfaceAccumulator- Returns:
-
-