Class MultiDimDoubleDataSet

    • Field Detail

      • values

        protected it.unimi.dsi.fastutil.doubles.DoubleArrayList[] values
    • Constructor Detail

      • MultiDimDoubleDataSet

        public MultiDimDoubleDataSet​(DataSet another)
        Creates a new instance of MultiDimDoubleDataSet as copy of another (deep-copy).
        Parameters:
        another - another Dataset to copy the content from
      • MultiDimDoubleDataSet

        public MultiDimDoubleDataSet​(java.lang.String name,
                                     int nDim)
        Creates a new instance of MultiDimDoubleDataSet.
        Parameters:
        name - name of this DataSet.
        nDim - the number of dimensions
        Throws:
        java.lang.IllegalArgumentException - if name is null
      • MultiDimDoubleDataSet

        public MultiDimDoubleDataSet​(java.lang.String name,
                                     boolean deepCopy,
                                     double[]... values)

        Creates a new instance of MultiDimDoubleDataSet.

        The user can 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.
        deepCopy - if true, the input array is copied
        values - the values for the new dataset double[nDims][nDataPoints]
        Throws:
        java.lang.IllegalArgumentException - if any of the parameters is null or if arrays with coordinates have different lengths
      • MultiDimDoubleDataSet

        public MultiDimDoubleDataSet​(java.lang.String name,
                                     int nDims,
                                     int initialSize)
        Creates a new instance of MultiDimDoubleDataSet.
        Parameters:
        name - name of this DataSet.
        nDims - the number of dimensions
        initialSize - initial size of the dataset
        Throws:
        java.lang.IllegalArgumentException - if name is null
    • Method Detail

      • add

        public MultiDimDoubleDataSet add​(double... newValues)
        Add point to the end of the data set
        Parameters:
        newValues - the coordinate of the new value
        Returns:
        itself
      • add

        public MultiDimDoubleDataSet add​(double[] newValues,
                                         java.lang.String label)
        Add point to the data set.
        Parameters:
        newValues - the coordinate of the new value
        label - the data label
        Returns:
        itself (fluent design)
      • add

        public MultiDimDoubleDataSet add​(double[][] valuesNew)
        Add array vectors to data set.
        Parameters:
        valuesNew - the coordinates of the new value
        Returns:
        itself
      • add

        public MultiDimDoubleDataSet add​(int index,
                                         double... newValues)
        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
        newValues - the coordinates for the new point
        Returns:
        itself (fluent design)
      • add

        public MultiDimDoubleDataSet add​(int index,
                                         double[] newValues,
                                         java.lang.String label)
        add point to the data set
        Parameters:
        index - data point index at which the new data point should be added
        newValues - coordinate of the new data point
        label - data point label (see CategoryAxis)
        Returns:
        itself (fluent design)
      • add

        public MultiDimDoubleDataSet add​(int index,
                                         double[][] newValues)
        add point to the data set
        Parameters:
        index - data point index at which the new data points should be added
        newValues - the coordinates of the new points
        Returns:
        itself (fluent design)
      • clearData

        public MultiDimDoubleDataSet 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
      • increaseCapacity

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

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

        public MultiDimDoubleDataSet set​(DataSet other,
                                         boolean copy)
        clear old data and overwrite with data from 'other' data set (deep copy)
        Specified by:
        set in interface DataSet
        Parameters:
        other - the source data set
        copy - true: perform a deep copy (default), false: reuse the other dataset's internal data structures (if applicable)
        Returns:
        itself (fluent design)
      • set

        public MultiDimDoubleDataSet set​(double[][] values)

        Initialises the data set with specified data.

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

        public MultiDimDoubleDataSet set​(double[][] values,
                                         boolean copy)

        Initialises the data set with specified data.

        Note: The method copies values from specified double arrays.
        Parameters:
        values - coordinates
        copy - true: makes an internal copy, false: use the pointer as is (saves memory allocation
        Returns:
        itself
      • setValues

        public MultiDimDoubleDataSet setValues​(int dimIndex,
                                               double[] values,
                                               boolean copy)

        Update the data for a given dimension

        Parameters:
        dimIndex - dimension index (e.g. DataSet.DIM_X)
        values - values for dimension
        copy - true: makes an internal copy, false: use the pointer as is (saves memory allocation
        Returns:
        itself
      • set

        public MultiDimDoubleDataSet 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 MultiDimDoubleDataSet set​(int index,
                                         double[][] values)
        Sets the values of the DataSet from index onwards. Clears all labels in the overwritten section of data.
        Parameters:
        index - start index of the data
        values - coordinates for the new points
        Returns:
        itself
      • trim

        public MultiDimDoubleDataSet trim()
        Trims the arrays list so that the capacity is equal to the size.
        Returns:
        itself (fluent design)
        See Also:
        ArrayList.trimToSize()
      • 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
      • getValue

        public double getValue​(int dimIndex,
                               double x)