Class CollectAccumulator
- java.lang.Object
-
- org.drools.core.base.accumulators.CollectAccumulator
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Accumulator
,Invoker
,RuleComponent
public class CollectAccumulator extends Object implements Accumulator, Externalizable
An accumulator to execute "collect" CEs- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.drools.core.spi.Accumulator
Accumulator.SafeAccumulator
-
-
Constructor Summary
Constructors Constructor Description CollectAccumulator()
CollectAccumulator(Collect collect, boolean unwrapHandle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
accumulate(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Declaration[] declarations, Declaration[] innerDeclarations, WorkingMemory workingMemory)
Executes the accumulate (action) code for the given fact handleObject
createContext()
Creates the context object for an accumulator session.Object
createWorkingMemoryContext()
Creates and return a context object for each working memory instanceboolean
equals(Object o)
Object
getResult(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, WorkingMemory workingMemory)
Gets the result of the accummulationint
hashCode()
Object
init(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, WorkingMemory workingMemory)
Executes the initialization block of codevoid
readExternal(ObjectInput in)
boolean
supportsReverse()
Returns true if this accumulator supports operation reversalboolean
tryReverse(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Object value, Declaration[] declarations, Declaration[] innerDeclarations, WorkingMemory workingMemory)
Reverses the accumulate action for the given fact handlevoid
writeExternal(ObjectOutput out)
-
-
-
Constructor Detail
-
CollectAccumulator
public CollectAccumulator()
-
CollectAccumulator
public CollectAccumulator(Collect collect, boolean unwrapHandle)
-
-
Method Detail
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
createContext
public Object createContext()
Description copied from interface:Accumulator
Creates 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:
createContext
in interfaceAccumulator
- Returns:
-
init
public Object init(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, WorkingMemory workingMemory)
Description copied from interface:Accumulator
Executes the initialization block of code- Specified by:
init
in interfaceAccumulator
leftTuple
- tuple causing the rule firedeclarations
- previous declarations
-
accumulate
public Object accumulate(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Declaration[] declarations, Declaration[] innerDeclarations, WorkingMemory workingMemory)
Description copied from interface:Accumulator
Executes the accumulate (action) code for the given fact handle- Specified by:
accumulate
in interfaceAccumulator
-
tryReverse
public boolean tryReverse(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Object value, Declaration[] declarations, Declaration[] innerDeclarations, WorkingMemory workingMemory)
Description copied from interface:Accumulator
Reverses the accumulate action for the given fact handle- Specified by:
tryReverse
in interfaceAccumulator
-
getResult
public Object getResult(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, WorkingMemory workingMemory)
Description copied from interface:Accumulator
Gets the result of the accummulation- Specified by:
getResult
in interfaceAccumulator
- Returns:
-
supportsReverse
public boolean supportsReverse()
Description copied from interface:Accumulator
Returns true if this accumulator supports operation reversal- Specified by:
supportsReverse
in interfaceAccumulator
- Returns:
-
createWorkingMemoryContext
public Object createWorkingMemoryContext()
Description copied from interface:Accumulator
Creates and return a context object for each working memory instance- Specified by:
createWorkingMemoryContext
in interfaceAccumulator
- Returns:
-
-