sim.util.media.chart
Class MinGapDataCuller
java.lang.Object
sim.util.media.chart.MinGapDataCuller
- All Implemented Interfaces:
- DataCuller
public class MinGapDataCuller
- extends java.lang.Object
- implements 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%.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MinGapDataCuller
public MinGapDataCuller(int maxPointCount)
MinGapDataCuller
public MinGapDataCuller(int maxPointCount,
int pointCountAfterCulling)
tooManyPoints
public boolean tooManyPoints(int currentPointCount)
- Specified by:
tooManyPoints
in interface DataCuller
cull
public IntBag cull(double[] xValues,
boolean sortedOutput)
- Specified by:
cull
in interface DataCuller
cullToSize
public static IntBag cullToSize(double[] xValues,
int size,
IntBag droppedIndices)