Class Compress

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean compressed
      the flag indicating whether the data is compressed
      protected int[] compressedIndexes
      the compressed series indexes
      protected double[] compressedXSeries
      the compressed X series
      protected double[] compressedYSeries
      the compressed Y series
      protected CompressConfig config
      the configuration for compressor
      protected CompressConfig prevConfig
      the previous configuration for compressor
      protected int previousXGridIndex
      the previous X grid index
      protected int previousYGridIndex
      the previous Y grid index
      protected double xLower
      the lower value of x range
      protected double[] xSeries
      the source X series to be compressed
      protected double xUpper
      the upper value of x range
      protected double yLower
      the lower value of y range
      protected double[] ySeries
      the source Y series to be compressed
      protected double yUpper
      the upper value of y range
    • Constructor Summary

      Constructors 
      Constructor Description
      Compress()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void addNecessaryPlots​(java.util.ArrayList<java.lang.Double> xList, java.util.ArrayList<java.lang.Double> yList, java.util.ArrayList<java.lang.Integer> indexList)
      Adds the necessary plots.
      protected void addToList​(java.util.ArrayList<java.lang.Double> xList, java.util.ArrayList<java.lang.Double> yList, java.util.ArrayList<java.lang.Integer> indexList, double x, double y, int index)
      Adds the given coordinate to list.
      boolean compress​(CompressConfig compressConfig)
      Ignores the points which are in the same grid as the previous point.
      int[] getCompressedIndexes()
      Gets the compressed series indexes
      double[] getCompressedXSeries()
      Gets the compressed X series
      double[] getCompressedYSeries()
      Gets the compressed Y series
      protected 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • previousXGridIndex

        protected int previousXGridIndex
        the previous X grid index
      • previousYGridIndex

        protected int previousYGridIndex
        the previous Y grid index
      • config

        protected CompressConfig config
        the configuration for compressor
      • prevConfig

        protected CompressConfig prevConfig
        the previous configuration for compressor
      • compressed

        protected boolean compressed
        the flag indicating whether the data is compressed
      • xSeries

        protected double[] xSeries
        the source X series to be compressed
      • ySeries

        protected double[] ySeries
        the source Y series to be compressed
      • compressedXSeries

        protected transient double[] compressedXSeries
        the compressed X series
      • compressedYSeries

        protected transient double[] compressedYSeries
        the compressed Y series
      • compressedIndexes

        protected transient int[] compressedIndexes
        the compressed series indexes
      • xLower

        protected double xLower
        the lower value of x range
      • xUpper

        protected double xUpper
        the upper value of x range
      • yLower

        protected double yLower
        the lower value of y range
      • yUpper

        protected double yUpper
        the upper value of y range
    • Constructor Detail

      • Compress

        public Compress()
    • Method Detail

      • setXSeries

        public void setXSeries​(double[] xSeries)
        Description copied from interface: ICompress
        Sets X series which have to be sorted.
        Specified by:
        setXSeries in interface ICompress
        Parameters:
        xSeries - the X series
      • setYSeries

        public void setYSeries​(double[] ySeries)
        Description copied from interface: ICompress
        sets the Y series
        Specified by:
        setYSeries in interface ICompress
        Parameters:
        ySeries - the Y series
      • getCompressedXSeries

        public double[] getCompressedXSeries()
        Description copied from interface: ICompress
        Gets the compressed X series
        Specified by:
        getCompressedXSeries in interface ICompress
        Returns:
        the compressed X series
      • getCompressedYSeries

        public double[] getCompressedYSeries()
        Description copied from interface: ICompress
        Gets the compressed Y series
        Specified by:
        getCompressedYSeries in interface ICompress
        Returns:
        the compressed Y series
      • getCompressedIndexes

        public int[] getCompressedIndexes()
        Description copied from interface: ICompress
        Gets the compressed series indexes
        Specified by:
        getCompressedIndexes in interface ICompress
        Returns:
        the compressed series indexes
      • compress

        public final boolean compress​(CompressConfig compressConfig)
        Description copied from interface: ICompress
        Ignores the points which are in the same grid as the previous point.
        Specified by:
        compress in interface ICompress
        Parameters:
        compressConfig - the configuration for compression
        Returns:
        true if the compression succeeds
      • addNecessaryPlots

        protected abstract void addNecessaryPlots​(java.util.ArrayList<java.lang.Double> xList,
                                                  java.util.ArrayList<java.lang.Double> yList,
                                                  java.util.ArrayList<java.lang.Integer> indexList)
        Adds the necessary plots.
        Parameters:
        xList - the array in which x coordinate for necessary plot is stored
        yList - the array in which y coordinate for necessary plot is stored
        indexList - the array in which series index for necessary plot is stored
      • addToList

        protected void addToList​(java.util.ArrayList<java.lang.Double> xList,
                                 java.util.ArrayList<java.lang.Double> yList,
                                 java.util.ArrayList<java.lang.Integer> indexList,
                                 double x,
                                 double y,
                                 int index)
        Adds the given coordinate to list.
        Parameters:
        xList - the list to store the X coordinate
        yList - the list to store the Y coordinate
        indexList - the list to store the series index
        x - the X coordinate
        y - the Y coordinate
        index - 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 coordinate
        y - the Y coordinate
        Returns:
        true if the given coordinate is in the same grid as previous