Package sim.util.media.chart
Class MinGapDataCuller
java.lang.Object
sim.util.media.chart.MinGapDataCuller
- All Implemented Interfaces:
DataCuller
This is meant as an on-line algorithm for keeping a constant number of data points
from an on-going time series. It only looks at the X values of the time series data points.
Specifically, this algorithm eliminates the point the leaves the smallest gap (i.e. has the closest neighbors). The first and last data point are never touched.
In case of ties, it chooses the first. This is meant to make the older data sparse while keeping more/most of the fresh data. Few gaps change between removes (2 old are merged, 1 new is introduced; 1. I could cache the gap sums 2. I could use a heap (although the tie breaking might be off)
For efficiency reasons, multiple points are dropped in one culling. The suggested (default) amount of points dropped in one culling is 50%.
-
Constructor Summary
ConstructorDescriptionMinGapDataCuller
(int maxPointCount) MinGapDataCuller
(int maxPointCount, int pointCountAfterCulling) -
Method Summary
Modifier and TypeMethodDescriptioncull
(double[] xValues, boolean sortedOutput) static IntBag
cullToSize
(double[] xValues, int size, IntBag droppedIndices) boolean
tooManyPoints
(int currentPointCount)
-
Constructor Details
-
MinGapDataCuller
public MinGapDataCuller(int maxPointCount) -
MinGapDataCuller
public MinGapDataCuller(int maxPointCount, int pointCountAfterCulling)
-
-
Method Details
-
tooManyPoints
public boolean tooManyPoints(int currentPointCount) - Specified by:
tooManyPoints
in interfaceDataCuller
-
cull
- Specified by:
cull
in interfaceDataCuller
-
cullToSize
-