public abstract class AIteratorITracePointStateEnginge extends AAccumulationIterator
While this approach may look a bit over-designed I decided to use it after a plain-forward implementation of accumulation - iterators grew into spaghetti-code.
Modifier and Type | Class and Description |
---|---|
class |
AIteratorITracePointStateEnginge.AAction
Overrides
AIteratorITracePointStateEnginge.AAction.toString() to make this class-cluster a bit more
debuggable. |
class |
AIteratorITracePointStateEnginge.ACondition
Overrides
AIteratorITracePointStateEnginge.ACondition.toString() to make this class-cluster a bit more
debuggable. |
static interface |
AIteratorITracePointStateEnginge.IAction
Interface for an action (upon a transition condition of a state) that knows
how to compute the output given for the input.
|
static interface |
AIteratorITracePointStateEnginge.ICondition
Interface for a condition that folds the mealy input (
ITracePoint2D
) into a boolean. |
class |
AIteratorITracePointStateEnginge.Transition
Implementation of a transition.
|
Constructor and Description |
---|
AIteratorITracePointStateEnginge(ITrace2D originalTrace,
IAccumulationFunction accumulationFunction,
IAccumulationStrategy.IAccumulationControl accumulationControl)
Constructor with all that is needed for accumulating points.
|
Modifier and Type | Method and Description |
---|---|
protected ITracePoint2D |
getPreviousPoint()
Returns the previous point read from the underlying iterator.
|
protected List<AIteratorITracePointStateEnginge.Transition>[] |
getTransitionTable()
Returns the transitionTable.
|
boolean |
hasNext() |
protected abstract List<AIteratorITracePointStateEnginge.Transition>[] |
initTransitionTable()
Template method to initialize your transition table here.
|
ITracePoint2D |
next() |
void |
reset(ITrace2D trace)
Allows to reuse this instance (by resetting to the initial state) with the
given trace.
|
protected void |
setStartState(Enum<?> startState)
Sets the startState.
|
getAccumulationControl, getAccumulationFunction, getOriginalIterator, getOriginalTrace, remove, setOriginalTrace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public AIteratorITracePointStateEnginge(ITrace2D originalTrace, IAccumulationFunction accumulationFunction, IAccumulationStrategy.IAccumulationControl accumulationControl)
originalTrace
- the iterator to decorate with the feature of accumulating points.accumulationFunction
- the function to use for point - accumulation.accumulationControl
- termination criteria for a single accumulation run.protected ITracePoint2D getPreviousPoint()
protected List<AIteratorITracePointStateEnginge.Transition>[] getTransitionTable()
protected void setStartState(Enum<?> startState)
startState
- the startState to setpublic void reset(ITrace2D trace)
This skips setting up the internal transition table (see
initTransitionTable()
anew and therefore bypasses unnecessary
computations.
trace
- the new trace this iterator will work for.protected abstract List<AIteratorITracePointStateEnginge.Transition>[] initTransitionTable()
You also have to setStartState(Enum)
to the first enum in your
STATES enum.
After this subsequent calls to next()
should be OK.
public boolean hasNext()
Iterator.hasNext()
public ITracePoint2D next()
Iterator.next()
Copyright © 2017. All rights reserved.