java.lang.Object
eu.bengreen.data.utility.DownSampleImpl
eu.bengreen.data.utility.LargestTriangleThreeBucketsTime
- All Implemented Interfaces:
DownSampler
A variation of the Largest-Triangle-Three-Buckets.
Modified by Fabrice Bacchella for NaN support.
Nested Class Summary
Nested classes/interfaces inherited from interface DownSampler
DownSampler.DataSetModifier and TypeInterfaceDescriptionstatic classRepresents a dataset containing timestamps and corresponding values.Field Summary
Fields inherited from class DownSampleImpl
thresholdModifier and TypeFieldDescriptionprotected final intNumber of data points to downsample to.Constructor Summary
ConstructorsConstructorDescriptionLargestTriangleThreeBucketsTime(int threshold) Builds a downsampler that reduces a time series to the requested point count.Method Summary
All MethodsModifier and TypeMethodDescriptiondownsizeImpl(DownSampler.DataSet sampled, long[] timestamps, double[] values) Keeps the largest-area point of each time bucket, preserving the series shape.Methods inherited from class DownSampleImpl
downsize, setDataSetLineModifier and TypeMethodDescriptiondownsize(long[] timestamps, double[] values) Downsample the given data.protected voidsetDataSetLine(DownSampler.DataSet sampled, int rank, long timestamp, double value) Populate a single element in the downsampled data set.
Constructor Details
LargestTriangleThreeBucketsTime
public LargestTriangleThreeBucketsTime(int threshold) Builds a downsampler that reduces a time series to the requested point count.- Parameters:
threshold- the number of points to downsize the series to
Method Details
downsizeImpl
public DownSampler.DataSet downsizeImpl(DownSampler.DataSet sampled, long[] timestamps, double[] values) Keeps the largest-area point of each time bucket, preserving the series shape.- Specified by:
downsizeImplin classDownSampleImpl- Parameters:
sampled- the empty output set allocated byDownSampleImpl.downsize(long[], double[]), holding exactly threshold timestamp and value slots to filltimestamps- the full source timestamps in seconds since the epoch, more than threshold in numbervalues- the full source values, the same length as timestamps- Returns:
- the same sampled set, with the threshold chosen ranks written into it