org.drools.spi
Interface Accumulator

All Superinterfaces:
Invoker, RuleComponent
All Known Implementing Classes:
CollectAccumulator, JavaAccumulatorFunctionExecutor, MVELAccumulator, MVELAccumulatorFunctionExecutor

public interface Accumulator
extends Invoker

Accumulator Created: 04/06/2006

Version:
$Id$

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
 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 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
 

Method Detail

createWorkingMemoryContext

Object createWorkingMemoryContext()
Creates and return a context object for each working memory instance

Returns:

createContext

Serializable createContext()
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.

Returns:

init

void init(Object workingMemoryContext,
          Object context,
          Tuple leftTuple,
          Declaration[] declarations,
          WorkingMemory workingMemory)
          throws Exception
Executes the initialization block of code

Parameters:
leftTuple - tuple causing the rule fire
declarations - previous declarations
workingMemory -
Throws:
Exception

accumulate

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

Parameters:
leftTuple -
handle -
declarations -
innerDeclarations -
workingMemory -
Throws:
Exception

supportsReverse

boolean supportsReverse()
Returns true if this accumulator supports operation reversal

Returns:

reverse

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

Parameters:
context -
leftTuple -
handle -
declarations -
innerDeclarations -
workingMemory -
Throws:
Exception

getResult

Object getResult(Object workingMemoryContext,
                 Object context,
                 Tuple leftTuple,
                 Declaration[] declarations,
                 WorkingMemory workingMemory)
                 throws Exception
Gets the result of the accummulation

Parameters:
leftTuple -
declarations -
workingMemory -
Returns:
Throws:
Exception


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