Class DoubleGridDataSet

    • Field Detail

      • grid

        protected transient double[][] grid
      • shape

        protected transient int[] shape
      • dataCount

        protected transient int dataCount
    • Constructor Detail

      • DoubleGridDataSet

        public DoubleGridDataSet​(GridDataSet another)
        Creates a new instance of DoubleDataSet as copy of another (deep-copy).
        Parameters:
        another - dataSet to copy into this dataSet
      • DoubleGridDataSet

        public DoubleGridDataSet​(java.lang.String name,
                                 int dims)
        Creates a new instance of DoubleDataSet.
        Parameters:
        name - name of this DataSet.
        dims - number of dimensions for the new data set, grid dimension will be dim-1
        Throws:
        java.lang.IllegalArgumentException - if name is null
      • DoubleGridDataSet

        public DoubleGridDataSet​(java.lang.String name,
                                 int nDims,
                                 int[] shape)
        Parameters:
        name - name for this DataSet
        nDims - number of Dimensions
        shape - Shape of the grid
      • DoubleGridDataSet

        public DoubleGridDataSet​(java.lang.String name,
                                 int[] shape,
                                 boolean copy,
                                 double[]... vals)
        Parameters:
        name - name for the dataSet
        shape - shape of the grid
        copy - whether to copy the values in vals
        vals - values
      • DoubleGridDataSet

        public DoubleGridDataSet​(java.lang.String name,
                                 boolean copy,
                                 double[][] grid,
                                 double[]... vals)
        Parameters:
        name - name for the dataSet
        copy - whether to copy the values from grid and vals
        grid - values for the grid
        vals - values
    • Method Detail

      • get

        public 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
      • 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
      • getShape

        public int[] getShape()
        Specified by:
        getShape in interface GridDataSet
        Returns:
        the shape of the grid of the data, e.g { 3, 4 } for a 3 x 4 matrix.
      • getShape

        public int getShape​(int dimIndex)
        Specified by:
        getShape in interface GridDataSet
        Parameters:
        dimIndex - the dimension to get the grid shape for
        Returns:
        the number of grid points in the given dimension
      • getGrid

        public double getGrid​(int dimIndex,
                              int index)
        Description copied from interface: GridDataSet
        Returns the Grid Value along the specified Grid dimension
        Specified by:
        getGrid in interface GridDataSet
        Parameters:
        dimIndex - Dimension Index, smaller than getShape().size
        index - Index along the specified dimension, smaller than getShape(dimIndex)
        Returns:
        the value for the specified index on the grid along the specified dimension
      • getGridValues

        public double[] getGridValues​(int dimIndex)
        Specified by:
        getGridValues in interface GridDataSet
        Parameters:
        dimIndex - Dimension Index, smaller than getShape().size
        Returns:
        A double[getShape(dimIndex)] array containing all the grid values along the specified dimension
      • get

        public double get​(int dimIndex,
                          int... indices)
        Specified by:
        get in interface GridDataSet
        Parameters:
        dimIndex - dimension to retrieve
        indices - indices to retrieve, missing indices are treated as zero
        Returns:
        the value for the given indices
      • set

        public void set​(boolean copy,
                        double[][] grid,
                        double[]... vals)
      • set

        public GridDataSet set​(DataSet another,
                               boolean copy)
        Specified by:
        set in interface DataSet
        Parameters:
        another - Other DataSet to copy into this DataSet
        copy - true: perform a deep copy (default), false: reuse the other dataset's internal data structures (if applicable)
        Returns:
        itself (fluent design) -- N.B. existing update listener are preserved
      • set

        public GridDataSet set​(int dimIndex,
                               int[] indices,
                               double value)
        Sets a single value on the grid
        Parameters:
        dimIndex - Dimension to set value for
        indices - grid indices to modify
        value - new Value
        Returns:
        itself for method chaining
      • clearData

        public void clearData()