org.drools.base.accumulators
Class JavaAccumulatorFunctionExecutor

java.lang.Object
  extended by org.drools.base.accumulators.JavaAccumulatorFunctionExecutor
All Implemented Interfaces:
Externalizable, Serializable, Accumulator, Invoker, RuleComponent, Wireable

public class JavaAccumulatorFunctionExecutor
extends Object
implements Accumulator, Externalizable, Wireable

A Java accumulator function executor implementation

See Also:
Serialized Form

Constructor Summary
JavaAccumulatorFunctionExecutor()
           
JavaAccumulatorFunctionExecutor(org.drools.runtime.rule.AccumulateFunction function)
           
 
Method Summary
 void accumulate(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Declaration[] declarations, Declaration[] innerDeclarations, WorkingMemory workingMemory)
          Executes the accumulate (action) code for the given fact handle
 Serializable createContext()
          Creates the context object for an accumulator session.
 Object createWorkingMemoryContext()
          Creates and return a context object for each working memory instance
 ReturnValueExpression getExpression()
           
 Object getResult(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, WorkingMemory workingMemory)
          Gets the result of the accummulation
 void init(Object workingMemoryContext, Object context, Tuple leftTuple, Declaration[] declarations, WorkingMemory workingMemory)
          Executes the initialization block of code
 void readExternal(ObjectInput in)
           
 void reverse(Object workingMemoryContext, Object context, Tuple leftTuple, InternalFactHandle handle, Declaration[] declarations, Declaration[] innerDeclarations, WorkingMemory workingMemory)
          Reverses the accumulate action for the given fact handle
 void setExpression(ReturnValueExpression expression)
           
 boolean supportsReverse()
          Returns true if this accumulator supports operation reversal
 void wire(Object object)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaAccumulatorFunctionExecutor

public JavaAccumulatorFunctionExecutor()

JavaAccumulatorFunctionExecutor

public JavaAccumulatorFunctionExecutor(org.drools.runtime.rule.AccumulateFunction function)
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

createContext

public Serializable 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 interface Accumulator
Returns:

init

public void init(Object workingMemoryContext,
                 Object context,
                 Tuple leftTuple,
                 Declaration[] declarations,
                 WorkingMemory workingMemory)
          throws Exception
Description copied from interface: Accumulator
Executes the initialization block of code

Specified by:
init in interface Accumulator
leftTuple - tuple causing the rule fire
declarations - previous declarations
Throws:
Exception

accumulate

public void accumulate(Object workingMemoryContext,
                       Object context,
                       Tuple leftTuple,
                       InternalFactHandle handle,
                       Declaration[] declarations,
                       Declaration[] innerDeclarations,
                       WorkingMemory workingMemory)
                throws Exception
Description copied from interface: Accumulator
Executes the accumulate (action) code for the given fact handle

Specified by:
accumulate in interface Accumulator
Throws:
Exception

reverse

public void reverse(Object workingMemoryContext,
                    Object context,
                    Tuple leftTuple,
                    InternalFactHandle handle,
                    Declaration[] declarations,
                    Declaration[] innerDeclarations,
                    WorkingMemory workingMemory)
             throws Exception
Description copied from interface: Accumulator
Reverses the accumulate action for the given fact handle

Specified by:
reverse in interface Accumulator
Throws:
Exception

getResult

public Object getResult(Object workingMemoryContext,
                        Object context,
                        Tuple leftTuple,
                        Declaration[] declarations,
                        WorkingMemory workingMemory)
                 throws Exception
Description copied from interface: Accumulator
Gets the result of the accummulation

Specified by:
getResult in interface Accumulator
Returns:
Throws:
Exception

supportsReverse

public boolean supportsReverse()
Description copied from interface: Accumulator
Returns true if this accumulator supports operation reversal

Specified by:
supportsReverse in interface Accumulator
Returns:

getExpression

public ReturnValueExpression getExpression()

wire

public void wire(Object object)
Specified by:
wire in interface Wireable

setExpression

public void setExpression(ReturnValueExpression expression)

createWorkingMemoryContext

public Object createWorkingMemoryContext()
Description copied from interface: Accumulator
Creates and return a context object for each working memory instance

Specified by:
createWorkingMemoryContext in interface Accumulator
Returns:


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.