public interface IAccumulationFunction extends Serializable
ITracePoint2D
instances into one.
This is for example needed to let
combine several tracepoints
into one.
ITrace2DDataAccumulating
Note that this does not describe the state-of-the-art plain interface for accumulating trace points (or even generic data) but is designed in a stateful manner that allows user-code to work on trace points in a stream based manner. So the design might look (and be) a bit hard to use / not-self explanatory. But this is done with performance in mind.
How to use
ITracePoint2D
instances (user code
should be in the iterator implementations of ITrace2D
implementations). Iterate in the following manner:
addPointToAccumulate(ITracePoint2D)
and increment your point
counter.getAccumulatedPoint()
and return it from your
iterator. As a side effect the accumulation function is in the state empty
again, ready for accumulation of the next n points.ITrace2DDataAccumulating.iterator(int)
.Modifier and Type | Method and Description |
---|---|
void |
addPointToAccumulate(ITracePoint2D point)
Adds a point to accumulated.
|
ITracePoint2D |
getAccumulatedPoint()
Returns the accumulated point resulting from all the points fed via
addPointToAccumulate(ITracePoint2D) since the last call this
method was invoked. |
int |
getAccumulatedPointCount()
Returns the current amount of accumulated points.
|
ITracePoint2D |
getAccumulatedPointCurrent()
Returns the current accumulated point.
|
void addPointToAccumulate(ITracePoint2D point) throws IllegalArgumentException
Contract: No point that returns true from
ITracePoint2D.isDiscontinuation()
must be given to this method. An
IllegalArgumentException
should punish violators of this contract.
Reason: Accumulating a discontinuation would consume it while it has to be
preserved to allow Chart2D
to render this.
point
- a point to accumulated.IllegalArgumentException
- if null or a point with ITracePoint2D.isDiscontinuation()
is provided.ITracePoint2D getAccumulatedPoint()
addPointToAccumulate(ITracePoint2D)
since the last call this
method was invoked.
As a side effect all previous accumulation data is reset and this function is empty again, ready to accumulate the next n points. Internally you might want to store the result in case you want to cherry pick the following point to accumulated in relation to it.
addPointToAccumulate(ITracePoint2D)
since the last call
this method was invoked. If there was nothing to accumulate
null
is returned.int getAccumulatedPointCount()
ITracePoint2D getAccumulatedPointCurrent()
Copyright © 2018. All rights reserved.