org.drools.base.mvel
Class MVELAccumulator

java.lang.Object
  extended by org.drools.base.mvel.MVELAccumulator
All Implemented Interfaces:
Externalizable, Serializable, MVELCompileable, Accumulator, Invoker, RuleComponent

public class MVELAccumulator
extends Object
implements MVELCompileable, Accumulator, Externalizable

An MVEL accumulator implementation

See Also:
Serialized Form

Constructor Summary
MVELAccumulator()
           
MVELAccumulator(MVELCompilationUnit initUnit, MVELCompilationUnit actionUnit, MVELCompilationUnit reverseUnit, MVELCompilationUnit resultUnit)
           
 
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
 void compile(MVELDialectRuntimeData runtimeData)
           
 Serializable createContext()
          Creates the context object for an accumulator session.
 Object createWorkingMemoryContext()
          Creates and return a context object for each working memory instance
 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
 boolean supportsReverse()
          Returns true if this accumulator supports operation reversal
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MVELAccumulator

public MVELAccumulator()

MVELAccumulator

public MVELAccumulator(MVELCompilationUnit initUnit,
                       MVELCompilationUnit actionUnit,
                       MVELCompilationUnit reverseUnit,
                       MVELCompilationUnit resultUnit)
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

compile

public void compile(MVELDialectRuntimeData runtimeData)
Specified by:
compile in interface MVELCompileable

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:

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-2013 JBoss Inc.. All Rights Reserved.