Last Updated: 3/4/97
Class NFDataSet

Class NFDataSet

public class NFDataSet implements NFCompare

NFDataSet is used to hold related data. Each element of the dataset can hold from one to three dimensional data although all data of the dataset must have the same number of dimensions.

Instance Variables

Type Name Description Default
private int fixed or variable size sizeType

Final Variables

Type Name Description
int FixedSize Fixed size data set
int OneDimensional One data component
int ThreeDimensional Three data components
int TwoDimensional Two data components
int UndefinedDimensions Nothing defined
int Variable Variable size data set
int XValue X-component
int YValue Y-component
int ZValue Z-component

Constructors

Methods


    public NFDataSet()
Default constructor. Creates a variable length dataset.

    public NFDataSet(int size)
Create a fixed size data set. As items are added beyond capacity, it removes earlier points.

    public void addNull()
Adds a null point to the dataset.

    public void addPoint(double x)
Adds a new point to a one dimensional dataset.

    public void addPoint(double x,
                         double y)
Adds a new point to a two dimensional dataset.

    public void addPoint(double x,
                         double y,
                         double z)
Adds a new point to a three dimensional dataset.

    private void addToDataSet(double x,
                              double y,
                              double z,
                              boolean isNull)
adds a point to the data set

    public void clear()
Deletes all points in the data set

    public void deleteNth(int nth) throws IllegalArgumentException
deletes the nth data value. if this is a fixed size vector, the point will be set to null.
Note that using indexes with fixed size datasets may cause unexpected results since the dataset shifts data after it fills.

    public double [] getDoubleArray()
returns an array of the datapoints in the dataset. this routine is intended only for use with one dimensional data sets.

    public double [] getDoubleArray(int value)
returns an array of the datapoints in the dataset given by value, where value is one of XValue, YValue, or ZValue.

    public int [] getIntegerArray()
returns an array of the datapoints in the dataset. this routine is intended only for use with one dimensional data sets.

    public int [] getIntegerArray(int value)
returns an array of the datapoints in the dataset given by value, where value is one of XValue, YValue, or ZValue.

    public String getLabel(int nth)
returns the string associated with the nth data point. Returns the empty string if dataset is empty. Returns the last label if nth is greater than the number of datapoints.
int nth - the label to return

    public String [] getLabelArray()
returns an array of data labels in the dataset

double[] getMinMax (int dim)
Returns the min and max values in the dataset for the given dimension, which can be XValue, YValue, or ZValue. The resultant array will contain two elements, with min first.

    public double getNth(int nth)
returns the nth data value. this routine is intended only for use with one dimensional data sets. If nth is greater than the dataset size, the last point will be returned. If the dataset is empty, a zero is returned.
Note that using indexes with fixed size datasets may cause unexpected results since the dataset shifts data after it fills.

    public double getNth(int nth,
                         int value)
returns the nth data value of the type given by value. If nth is greater than the dataset size, the last point will be returned. If the dataset is empty, a zero is returned.
int nth - the nth data value to return int value - either XValue, YValue, or ZValue
Note that using indexes with fixed size datasets may cause unexpected results since the dataset shifts data after it fills.

    private protected NFDataPoint getPoint(int nth)
return the nth data point in the data set

    public int getType()
Returns the type of data in the dataset: OneDimensional, TwoDimensional, ThreeDimensional or UndefinedDimensions.

    public void setLabel(int nth,
                         String label)
This function is obsolete and should not be used. The string should be passed in with the dataset. This method will not work with fixed size datasets.

    public double shift() throws Exception
Returns the "first" item from the vector and removes it from the vector storage. this routine is intended only for use with one dimensional data sets.

    public double shift(int value) throws Exception
Returns the "first" item from the vector and removes it from the vector storage.

    public int size()
returns the size (number of points) of the dataset.

    public void sort()
Implements qsort function on one dimensional data sets. Works properly only on variable length data sets.