org.drools.base.accumulators
Class SumAccumulateFunction

java.lang.Object
  extended by org.drools.base.accumulators.SumAccumulateFunction
All Implemented Interfaces:
java.io.Serializable, AccumulateFunction

public class SumAccumulateFunction
extends java.lang.Object
implements AccumulateFunction

An implementation of an accumulator capable of calculating sum of values

Author:
etirelli
See Also:
Serialized Form

Nested Class Summary
protected static class SumAccumulateFunction.SumData
           
 
Constructor Summary
SumAccumulateFunction()
           
 
Method Summary
 void accumulate(java.lang.Object context, java.lang.Object value)
          Executes the accumulation action
 java.lang.Object createContext()
          Creates and returns a new context object
 java.lang.Object getResult(java.lang.Object context)
          Returns the current value in this accumulation session
 void init(java.lang.Object context)
          Initializes the accumulator
 void reverse(java.lang.Object context, java.lang.Object value)
          Reverses the accumulation action
 boolean supportsReverse()
          True if the function supports reverse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SumAccumulateFunction

public SumAccumulateFunction()
Method Detail

createContext

public java.lang.Object createContext()
Description copied from interface: AccumulateFunction
Creates and returns a new context object

Specified by:
createContext in interface AccumulateFunction
Returns:

init

public void init(java.lang.Object context)
          throws java.lang.Exception
Description copied from interface: AccumulateFunction
Initializes the accumulator

Specified by:
init in interface AccumulateFunction
Throws:
java.lang.Exception

accumulate

public void accumulate(java.lang.Object context,
                       java.lang.Object value)
Description copied from interface: AccumulateFunction
Executes the accumulation action

Specified by:
accumulate in interface AccumulateFunction

reverse

public void reverse(java.lang.Object context,
                    java.lang.Object value)
             throws java.lang.Exception
Description copied from interface: AccumulateFunction
Reverses the accumulation action

Specified by:
reverse in interface AccumulateFunction
Throws:
java.lang.Exception

getResult

public java.lang.Object getResult(java.lang.Object context)
                           throws java.lang.Exception
Description copied from interface: AccumulateFunction
Returns the current value in this accumulation session

Specified by:
getResult in interface AccumulateFunction
Returns:
Throws:
java.lang.Exception

supportsReverse

public boolean supportsReverse()
Description copied from interface: AccumulateFunction
True if the function supports reverse. False otherwise.

Specified by:
supportsReverse in interface AccumulateFunction
Returns: