|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.shapelogic.calculation.BaseAccumulator<In,Out>
In
- Out
- public abstract class BaseAccumulator<In,Out>
BaseAccumulator accumulator. For use with Streams and Iterators.
Field Summary | |
---|---|
protected boolean |
_dirty
|
protected java.util.Iterator<In> |
_input
|
protected In |
_inputElement
|
protected In |
_previousInputElement
|
protected Out |
_previousValue
|
protected Out |
_value
|
Constructor Summary | |
---|---|
BaseAccumulator(java.util.Iterator<In> input)
|
Method Summary | |
---|---|
abstract Out |
accumulate(In element,
Out out)
return element + out; |
java.util.Iterator<In> |
getInput()
|
Out |
getPreviousValue()
Not sure if this should be a lazy calculation too. |
Out |
getValue()
Starts a lazy calculation. |
boolean |
hasNext()
|
boolean |
isDirty()
When dirty is false that means that the calculated value can be used |
Out |
next()
|
void |
remove()
|
void |
setup()
Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Iterator<In> _input
protected boolean _dirty
protected Out _value
protected Out _previousValue
protected In _inputElement
protected In _previousInputElement
Constructor Detail |
---|
public BaseAccumulator(java.util.Iterator<In> input)
Method Detail |
---|
public abstract Out accumulate(In element, Out out)
Accumulator
accumulate
in interface Accumulator<In,Out>
public java.util.Iterator<In> getInput()
getInput
in interface Accumulator<In,Out>
public boolean hasNext()
hasNext
in interface java.util.Iterator<Out>
public Out next()
next
in interface java.util.Iterator<Out>
public void remove()
remove
in interface java.util.Iterator<Out>
public boolean isDirty()
LazyCalc
isDirty
in interface LazyCalc<Out>
public void setup()
LazyCalc
setup
in interface LazyCalc<Out>
public Out getValue()
CalcValue
getValue
in interface CalcValue<Out>
public Out getPreviousValue()
getPreviousValue
in interface Accumulator<In,Out>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |