Class DoubleDataSet

    • Field Detail

      • xValues

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

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

      • DoubleDataSet

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

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

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

        Creates a new instance of DoubleDataSet.

        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
        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
      • DoubleDataSet

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

      • add

        public DoubleDataSet add​(double x,
                                 double y)
        Add point to the end of the data set
        Parameters:
        x - index
        y - index
        Returns:
        itself
      • add

        public DoubleDataSet add​(double x,
                                 double y,
                                 java.lang.String label)
        Add point to the data set.
        Parameters:
        x - horizontal coordinate of the new data point
        y - vertical coordinate of the new data point
        label - the data label
        Returns:
        itself (fluent design)
      • add

        public DoubleDataSet add​(double[] xValuesNew,
                                 double[] yValuesNew)
        Add array vectors to data set.
        Parameters:
        xValuesNew - X coordinates
        yValuesNew - Y coordinates
        Returns:
        itself
      • add

        public DoubleDataSet add​(int index,
                                 double... newValue)
        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
        newValue - new data point coordinate
        Returns:
        itself (fluent design)
      • add

        public DoubleDataSet add​(int index,
                                 double x,
                                 double y)
        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
        Returns:
        itself (fluent design)
      • add

        public DoubleDataSet add​(int index,
                                 double x,
                                 double y,
                                 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
        label - data point label (see CategoryAxis)
        Returns:
        itself (fluent design)
      • add

        public DoubleDataSet add​(int index,
                                 double[] x,
                                 double[] y)
        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
        Returns:
        itself (fluent design)
      • clearData

        public DoubleDataSet clearData()
        clear all data points
        Returns:
        itself (fluent design)
      • get

        public final double get​(int dimIndex,
                                int index)
        Description copied from interface: DataSet
        Gets the x value of the data point with the index i
        Specified by:
        get in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        index - data point index
        Returns:
        the x value
      • getCapacity

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

        public int getDataCount​(int dimIndex)
        Description copied from interface: DataSet
        Get the number of data points in the data set for a specific dimension.
        Specified by:
        getDataCount in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        Returns:
        the number of data points
      • getValues

        public final double[] getValues​(int dimIndex)
        Specified by:
        getValues in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        Returns:
        the x value array
      • increaseCapacity

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

        public EditableDataSet remove​(int index)
        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 DoubleDataSet remove​(int fromIndex,
                                    int toIndex)
        removes sub-range of data points
        Parameters:
        fromIndex - start index
        toIndex - stop index
        Returns:
        itself (fluent design)
      • resize

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

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

        public DoubleDataSet set​(double[] xValues,
                                 double[] yValues)

        Initialises the data set with specified data.

        Note: The method copies values from specified double arrays.
        Parameters:
        xValues - X coordinates
        yValues - Y coordinates
        Returns:
        itself
      • set

        public DoubleDataSet set​(double[] xValues,
                                 double[] yValues,
                                 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
        copy - true: makes an internal copy, false: use the pointer as is (saves memory allocation
        Returns:
        itself
      • set

        public DoubleDataSet set​(double[] xValues,
                                 double[] yValues,
                                 int nSamples,
                                 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
        nSamples - number of samples to be copied
        copy - true: makes an internal copy, false: use the pointer as is (saves memory allocation
        Returns:
        itself
      • set

        public DoubleDataSet set​(int index,
                                 double... newValue)
        replaces point coordinate of existing data point
        Specified by:
        set in interface EditableDataSet
        Parameters:
        index - data point index at which the new data point should be added
        newValue - new data point coordinate
        Returns:
        itself (fluent design)
      • set

        public DoubleDataSet set​(int index,
                                 double x,
                                 double y)
        replaces point coordinate of existing data point
        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 DoubleDataSet set​(int index,
                                 double[] x,
                                 double[] y)
      • trim

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