Class DoubleErrorDataSet

    • Field Detail

      • xValues

        protected it.unimi.dsi.fastutil.doubles.DoubleArrayList xValues
      • yValues

        protected it.unimi.dsi.fastutil.doubles.DoubleArrayList yValues
      • yErrorsPos

        protected it.unimi.dsi.fastutil.doubles.DoubleArrayList yErrorsPos
      • yErrorsNeg

        protected it.unimi.dsi.fastutil.doubles.DoubleArrayList yErrorsNeg
    • Constructor Detail

      • DoubleErrorDataSet

        public DoubleErrorDataSet​(java.lang.String name)
        Creates a new instance of DoubleErrorDataSet.
        Parameters:
        name - name of this DataSet.
        Throws:
        java.lang.IllegalArgumentException - if name is null
      • DoubleErrorDataSet

        public DoubleErrorDataSet​(java.lang.String name,
                                  int initalSize)
        Creates a new instance of DoubleErrorDataSet.
        Parameters:
        name - name of this DataSet.
        initalSize - initial capacity of buffer (N.B. size=0)
        Throws:
        java.lang.IllegalArgumentException - if name is null
      • DoubleErrorDataSet

        public DoubleErrorDataSet​(DataSet another)
        Creates a new instance of DoubleErrorDataSet as copy of another (deep-copy).
        Parameters:
        another - name of this DataSet.
      • DoubleErrorDataSet

        public DoubleErrorDataSet​(java.lang.String name,
                                  double[] xValues,
                                  double[] yValues,
                                  double[] yErrorsNeg,
                                  double[] yErrorsPos,
                                  int initalSize,
                                  boolean deepCopy)

        Creates a new instance of DoubleErrorDataSet.

        The user than specify via the copy parameter, whether the dataset wraps the input arrays themselves or on a copies of the input arrays.
        Parameters:
        name - name of this data set.
        xValues - X coordinates
        yValues - Y coordinates
        yErrorsNeg - Y negative coordinate error
        yErrorsPos - Y positive coordinate error
        initalSize - how many data points are relevant to be taken
        deepCopy - if true, the input array is copied
        Throws:
        java.lang.IllegalArgumentException - if any of the parameters is null or if arrays with coordinates have different lengths
    • Method Detail

      • getXValues

        public double[] getXValues()
        Specified by:
        getXValues in interface DataSet
        Returns:
        the x value array
      • getYValues

        public double[] getYValues()
        Specified by:
        getYValues in interface DataSet
        Returns:
        the y value array
      • getYErrorsPositive

        public double[] getYErrorsPositive()
        Description copied from interface: DataSetError
        Returns the positive error along the y axis for all available data points. Please note that errors are assumed to be always positive!
        Specified by:
        getYErrorsPositive in interface DataSetError
        Returns:
        array containing positive y error
      • getYErrorsNegative

        public double[] getYErrorsNegative()
        Description copied from interface: DataSetError
        Returns the negative error along the Y axis for all available data points. Please note that errors are assumed to be always positive!
        Specified by:
        getYErrorsNegative in interface DataSetError
        Returns:
        array containing negative Y error
      • getDataCount

        public int getDataCount()
        Description copied from interface: DataSet
        Get the number of data points in the data set
        Specified by:
        getDataCount in interface DataSet
        Returns:
        the number of data points
      • clearData

        public DoubleErrorDataSet clearData()
        clears all data
        Returns:
        itself (fluent design)
      • getCapacity

        public int getCapacity()
        Returns:
        storage capacity of dataset
      • increaseCapacity

        public DoubleErrorDataSet increaseCapacity​(int amount)
        Parameters:
        amount - storage capacity increase
        Returns:
        itself (fluent design)
      • resize

        public DoubleErrorDataSet resize​(int size)
        ensures minimum size, enlarges if necessary
        Parameters:
        size - the actually used array lengths
        Returns:
        itself (fluent design)
      • trim

        public DoubleErrorDataSet trim()
        Trims the arrays list so that the capacity is equal to the size.
        Returns:
        itself (fluent design)
        See Also:
        ArrayList.trimToSize()
      • getX

        public double getX​(int index)
        Description copied from interface: DataSet
        Gets the x value of the data point with the index i
        Specified by:
        getX in interface DataSet
        Parameters:
        index - the index of the data point
        Returns:
        the x value
      • getY

        public double getY​(int index)
        Description copied from interface: DataSet
        Gets the y value of the data point with the index i
        Specified by:
        getY in interface DataSet
        Parameters:
        index - the index of the data point
        Returns:
        the y value
      • getXErrorNegative

        public double getXErrorNegative​(int index)
        Description copied from interface: DataSetError
        Returns the negative error along the X axis of a point specified by the index. Please note that errors are assumed to be always positive!
        Specified by:
        getXErrorNegative in interface DataSetError
        Parameters:
        index - of negative X error to be returned.
        Returns:
        negative X error
      • getXErrorPositive

        public double getXErrorPositive​(int index)
        Description copied from interface: DataSetError
        Returns the positive error along the X axis of a point specified by the index. Please note that errors are assumed to be always positive!
        Specified by:
        getXErrorPositive in interface DataSetError
        Parameters:
        index - of positive X error to be returned.
        Returns:
        positive X error
      • getYErrorNegative

        public double getYErrorNegative​(int index)
        Description copied from interface: DataSetError
        Returns the negative error along the Y axis of a point specified by the index. Please note that errors are assumed to be always positive!
        Specified by:
        getYErrorNegative in interface DataSetError
        Parameters:
        index - of negative Y error to be returned.
        Returns:
        negative Y error
      • getYErrorPositive

        public double getYErrorPositive​(int index)
        Description copied from interface: DataSetError
        Returns the positive error along the Y axis of a point specified by the index. Please note that errors are assumed to be always positive!
        Specified by:
        getYErrorPositive in interface DataSetError
        Parameters:
        index - of positive Y error to be returned.
        Returns:
        positive Y error
      • add

        public DoubleErrorDataSet add​(double x,
                                      double y)
        add point to the data set
        Parameters:
        x - horizontal coordinate of the new data point
        y - vertical coordinate of the new data point
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(double x,
                                      double y,
                                      double yErrorNeg,
                                      double yErrorPos)
        Add point to the data set.
        Parameters:
        x - the new x coordinate
        y - the new y coordinate
        yErrorNeg - the +dy error
        yErrorPos - the -dy error
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(double x,
                                      double y,
                                      double yErrorNeg,
                                      double yErrorPos,
                                      java.lang.String label)
        Add point to the data set.
        Parameters:
        x - the new x coordinate
        y - the new y coordinate
        yErrorNeg - the +dy error
        yErrorPos - the -dy error
        label - the data label
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(double[] xValuesNew,
                                      double[] yValuesNew,
                                      double[] yErrorsNegNew,
                                      double[] yErrorsPosNew)
        Add array vectors to data set.
        Parameters:
        xValuesNew - X coordinates
        yValuesNew - Y coordinates
        yErrorsNegNew - the +dy errors
        yErrorsPosNew - the -dy errors
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(int index,
                                      double x,
                                      double y)
        add point to the data set
        Specified by:
        add in interface EditableDataSet
        Parameters:
        index - data point index at which the new data point should be added
        x - horizontal coordinate of the new data point
        y - vertical coordinate of the new data point
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(int index,
                                      double x,
                                      double y,
                                      double yErrorNeg,
                                      double yErrorPos)
        add point to the data set
        Parameters:
        index - data point index at which the new data point should be added
        x - horizontal coordinate of the new data point
        y - vertical coordinate of the new data point
        yErrorNeg - the +dy error
        yErrorPos - the -dy error
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(int index,
                                      double x,
                                      double y,
                                      double yErrorNeg,
                                      double yErrorPos,
                                      java.lang.String label)
        add point to the data set
        Parameters:
        index - data point index at which the new data point should be added
        x - horizontal coordinates of the new data point
        y - vertical coordinates of the new data point
        yErrorNeg - the +dy error
        yErrorPos - the -dy error
        label - data point label (see CategoryAxis)
        Returns:
        itself (fluent design)
      • add

        public DoubleErrorDataSet add​(int index,
                                      double[] x,
                                      double[] y,
                                      double[] yErrorNeg,
                                      double[] yErrorPos)
        add point to the data set
        Parameters:
        index - data point index at which the new data point should be added
        x - horizontal coordinate of the new data point
        y - vertical coordinate of the new data point
        yErrorNeg - the +dy error
        yErrorPos - the -dy error
        Returns:
        itself (fluent design)
      • remove

        public DoubleErrorDataSet remove​(int index)
        Description copied from interface: EditableDataSet
        remove point from data set
        Specified by:
        remove in interface EditableDataSet
        Parameters:
        index - data point which should be removed
        Returns:
        itself (fluent design)
      • remove

        public DoubleErrorDataSet remove​(int fromIndex,
                                         int toIndex)
        remove sub-range of data points
        Parameters:
        fromIndex - start index
        toIndex - stop index
        Returns:
        itself (fluent design)
      • set

        public DoubleErrorDataSet set​(int index,
                                      double x,
                                      double y)
        replaces point coordinate of existing data point
        Specified by:
        set in interface EditableDataSet
        Parameters:
        index - the index of the data point
        x - new horizontal coordinate
        y - new vertical coordinate N.B. errors are implicitly assumed to be zero
        Returns:
        itself (fluent design)
      • set

        public DoubleErrorDataSet set​(int index,
                                      double x,
                                      double y,
                                      double yErrorNeg,
                                      double yErrorPos)
        replaces point coordinate of existing data point
        Parameters:
        index - the index of the data point
        x - new horizontal coordinate
        y - new vertical coordinate
        yErrorNeg - new vertical negative error of y (can be asymmetric)
        yErrorPos - new vertical positive error of y (can be asymmetric)
        Returns:
        itself (fluent design)
      • set

        public DoubleErrorDataSet set​(int index,
                                      double[] x,
                                      double[] y,
                                      double[] yErrorNeg,
                                      double[] yErrorPos)
      • set

        public DoubleErrorDataSet set​(double[] xValues,
                                      double[] yValues,
                                      double[] yErrorsNeg,
                                      double[] yErrorsPos,
                                      boolean copy)

        Initialises the data set with specified data.

        Note: The method copies values from specified double arrays.
        Parameters:
        xValues - X coordinates
        yValues - Y coordinates
        yErrorsNeg - the +dy errors
        yErrorsPos - the -dy errors
        copy - true: makes an internal copy, false: use the pointer as is (saves memory allocation)
        Returns:
        itself (fluent design)
      • set

        public DoubleErrorDataSet set​(double[] xValues,
                                      double[] yValues,
                                      double[] yErrorsNeg,
                                      double[] yErrorsPos)

        Initialises the data set with specified data.

        Note: The method copies values from specified double arrays.
        Parameters:
        xValues - X coordinates
        yValues - Y coordinates
        yErrorsNeg - the +dy errors
        yErrorsPos - the -dy errors
        Returns:
        itself (fluent design)
      • set

        public DoubleErrorDataSet set​(DataSet other)
        clear old data and overwrite with data from 'other' data set (deep copy)
        Parameters:
        other - the other data set
        Returns:
        itself (fluent design)