org.shapelogic.mathematics
Class SumAccumulator

java.lang.Object
  extended by org.shapelogic.calculation.BaseAccumulator<java.lang.Integer,java.lang.Long>
      extended by org.shapelogic.mathematics.SumAccumulator
All Implemented Interfaces:
java.util.Iterator<java.lang.Long>, Accumulator<java.lang.Integer,java.lang.Long>, CalcValue<java.lang.Long>, LazyCalc<java.lang.Long>

public class SumAccumulator
extends BaseAccumulator<java.lang.Integer,java.lang.Long>

AddAccumulator is an accumulator that add integers. Since this is used so much.

Author:
Sami Badawi

Field Summary
 
Fields inherited from class org.shapelogic.calculation.BaseAccumulator
_dirty, _input, _inputElement, _previousInputElement, _previousValue, _value
 
Constructor Summary
SumAccumulator(java.util.Iterator<java.lang.Integer> input)
           
 
Method Summary
 java.lang.Long accumulate(java.lang.Integer element, java.lang.Long out)
          return element + out;
 
Methods inherited from class org.shapelogic.calculation.BaseAccumulator
getInput, getPreviousValue, getValue, hasNext, isDirty, next, remove, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SumAccumulator

public SumAccumulator(java.util.Iterator<java.lang.Integer> input)
Method Detail

accumulate

public java.lang.Long accumulate(java.lang.Integer element,
                                 java.lang.Long out)
Description copied from interface: Accumulator
return element + out;

Specified by:
accumulate in interface Accumulator<java.lang.Integer,java.lang.Long>
Specified by:
accumulate in class BaseAccumulator<java.lang.Integer,java.lang.Long>


Copyright © 2009. All Rights Reserved.