Package org.swtchart.internal.compress
Class Compress
java.lang.Object
org.swtchart.internal.compress.Compress
- All Implemented Interfaces:
ICompress
- Direct Known Subclasses:
CompressBarSeries
,CompressLineSeries
,CompressScatterSeries
A base class for compressor providing default implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
the flag indicating whether the data is compressedprotected int[]
the compressed series indexesprotected double[]
the compressed X seriesprotected double[]
the compressed Y seriesprotected CompressConfig
the configuration for compressorprotected CompressConfig
the previous configuration for compressorprotected int
the previous X grid indexprotected int
the previous Y grid indexprotected double
the lower value of x rangeprotected double[]
the source X series to be compressedprotected double
the upper value of x rangeprotected double
the lower value of y rangeprotected double[]
the source Y series to be compressedprotected double
the upper value of y range -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Adds the necessary plots.protected void
addToList
(ArrayList<Double> xList, ArrayList<Double> yList, ArrayList<Integer> indexList, double x, double y, int index) Adds the given coordinate to list.final boolean
compress
(CompressConfig compressConfig) Ignores the points which are in the same grid as the previous point.int[]
Gets the compressed series indexesdouble[]
Gets the compressed X seriesdouble[]
Gets the compressed Y seriesprotected boolean
isInSameGridAsPrevious
(double x, double y) Checks if the given coordinate is in the same grid as previous.void
setXSeries
(double[] xSeries) Sets X series which have to be sorted.void
setYSeries
(double[] ySeries) sets the Y series
-
Field Details
-
previousXGridIndex
protected int previousXGridIndexthe previous X grid index -
previousYGridIndex
protected int previousYGridIndexthe previous Y grid index -
config
the configuration for compressor -
prevConfig
the previous configuration for compressor -
compressed
protected boolean compressedthe flag indicating whether the data is compressed -
xSeries
protected double[] xSeriesthe source X series to be compressed -
ySeries
protected double[] ySeriesthe source Y series to be compressed -
compressedXSeries
protected transient double[] compressedXSeriesthe compressed X series -
compressedYSeries
protected transient double[] compressedYSeriesthe compressed Y series -
compressedIndexes
protected transient int[] compressedIndexesthe compressed series indexes -
xLower
protected double xLowerthe lower value of x range -
xUpper
protected double xUpperthe upper value of x range -
yLower
protected double yLowerthe lower value of y range -
yUpper
protected double yUpperthe upper value of y range
-
-
Constructor Details
-
Compress
public Compress()
-
-
Method Details
-
setXSeries
public void setXSeries(double[] xSeries) Description copied from interface:ICompress
Sets X series which have to be sorted.- Specified by:
setXSeries
in interfaceICompress
- Parameters:
xSeries
- the X series
-
setYSeries
public void setYSeries(double[] ySeries) Description copied from interface:ICompress
sets the Y series- Specified by:
setYSeries
in interfaceICompress
- Parameters:
ySeries
- the Y series
-
getCompressedXSeries
public double[] getCompressedXSeries()Description copied from interface:ICompress
Gets the compressed X series- Specified by:
getCompressedXSeries
in interfaceICompress
- Returns:
- the compressed X series
-
getCompressedYSeries
public double[] getCompressedYSeries()Description copied from interface:ICompress
Gets the compressed Y series- Specified by:
getCompressedYSeries
in interfaceICompress
- Returns:
- the compressed Y series
-
getCompressedIndexes
public int[] getCompressedIndexes()Description copied from interface:ICompress
Gets the compressed series indexes- Specified by:
getCompressedIndexes
in interfaceICompress
- Returns:
- the compressed series indexes
-
compress
Description copied from interface:ICompress
Ignores the points which are in the same grid as the previous point. -
addNecessaryPlots
protected abstract void addNecessaryPlots(ArrayList<Double> xList, ArrayList<Double> yList, ArrayList<Integer> indexList) Adds the necessary plots.- Parameters:
xList
- the array in which x coordinate for necessary plot is storedyList
- the array in which y coordinate for necessary plot is storedindexList
- the array in which series index for necessary plot is stored
-
addToList
protected void addToList(ArrayList<Double> xList, ArrayList<Double> yList, ArrayList<Integer> indexList, double x, double y, int index) Adds the given coordinate to list.- Parameters:
xList
- the list to store the X coordinateyList
- the list to store the Y coordinateindexList
- the list to store the series indexx
- the X coordinatey
- the Y coordinateindex
- the series index
-
isInSameGridAsPrevious
protected boolean isInSameGridAsPrevious(double x, double y) Checks if the given coordinate is in the same grid as previous.- Parameters:
x
- the X coordinatey
- the Y coordinate- Returns:
- true if the given coordinate is in the same grid as previous
-