All Packages Class Hierarchy This Package Previous Next Index
Class edu.wpi.mqp.graphics.jviz.Data
java.lang.Object
|
+----edu.wpi.mqp.graphics.jviz.Data
- public class Data
- extends Object
- implements Cloneable
The Data class is the container class. It contains information such as
the number of dimensions, and the values for the data points within the
data.
- Version:
- 1.0, created 21 OCT 1997
- Author:
- Matthew C. Jucius
-
capacity
-
-
dataPoints
-
-
dimensionData
-
-
numDataPoints
-
-
Data()
-
This constructor for Data initilizes the public variables.
-
addDataPoint(double[])
-
This method, addDatapoint, takes a DataPoint object as an argument and
adds it to the end of the dataPoints array.
-
addDimension(DimensionalData)
-
Will add a DimensionalData object to the end the dimensionData vector.
-
clone()
-
This allows this class to be cloned
-
getActiveDataPoint(int)
-
This method will return an exact sized double array with the values of
a data point that are within active dimensions.
-
getActiveDimensionData(int)
-
This method is another getActive***() method.
-
getActiveDimensions()
-
This function, getActiveDimensions, returns an array of indicies to the
dimensions which are active.
-
getAllActiveDataPoints()
-
This method is a convience function, but it is quite inefficient.
-
getDataPoint(int)
-
This method will return a double array of the data point at the specified
specified index into the data points array
-
getDimensionData(int)
-
Returns the specified dimensions
-
getNumActiveDimensions()
-
This method, getNumActiveDimensions, returns the number of active
dimensions in the data set.
-
getNumDataPoints()
-
Gets the number of data points in the dataPoints array.
-
getNumDimensions()
-
Returns the total number of dimensions whether they are active or not.
numDataPoints
protected int numDataPoints
capacity
protected int capacity
dataPoints
protected double dataPoints[][]
dimensionData
protected Vector dimensionData
Data
public Data()
- This constructor for Data initilizes the public variables.
addDataPoint
public int addDataPoint(double dataSet[])
- This method, addDatapoint, takes a DataPoint object as an argument and
adds it to the end of the dataPoints array. This two-dimensional array
grows incrementally. When the capacity has been reached, a newer, larger
array is instantiated and the contents of the old are transferred into the
new array. Each step in growth increases capacity by 1024 data points.
- Parameters:
- dataSet - an array of doubles that contain all the values for a
data point.
- Returns:
- the index of the point that was added to the array
getDataPoint
public double[] getDataPoint(int dataPointIndex)
- This method will return a double array of the data point at the specified
specified index into the data points array
- Parameters:
- dataValueIndex - the index of the object to return
- Returns:
- double array of entire point
getAllActiveDataPoints
public double[][] getAllActiveDataPoints()
- This method is a convience function, but it is quite inefficient. It will
return a huge array of all the data points, but only include the values
for the active dimensions. If first determines what the active dimensions
are, instatitates a huge array of doubles, and then copies the associated
values into the new array. Finally, it returns the array.
- Returns:
- activeDataPoints two-dimensional array of doubles
getActiveDimensions
public int[] getActiveDimensions()
- This function, getActiveDimensions, returns an array of indicies to the
dimensions which are active. The values for the data points are stored in
a two dimensional array. If a dimension is deactivated, this object must
be able to present an interface to the outside world that hides the
details of this. That is what the getActive***() methods are for. They
will return the values for a virtual data set that changes whenever a
dimension is activated or deactivated. They admittedly use a horrible
naming scheme and the implementation is much more inefficient, but they
do work. This function provides a way to map between the numbering
scheme of the virtual data set with deactivated dimensions and the real
data set. If this function returns an array with values:
0 2 3 4 5
and the real data set has 6 dimensions, you would know that, in the real
data set, column 1 has been deactivated. This also means dimension 1
has been deactivated. You can determine, using array.lenth, that there
are 5 active dimensions. The concept may be confusing, but the numbers
line up quite nicely when the getActive***() methods are used consistently
One important note for future work, if this function could be implemented
more efficiently, many of the getActive***() methods would becore much
more efficient. This method can be a bottleneck. If there was a way
to keep track of each activation and deactivation of a dimension within
this class, a check through all the dimensions would not have to be made
each time this method was called. If all dimensions activation and
deactivation was done through this class, it might be possible, but that
is not how it is currently being done in JViz.
- Returns:
- activeDimentions int array of indices of active dimensions in
the real data set.
getNumActiveDimensions
public int getNumActiveDimensions()
- This method, getNumActiveDimensions, returns the number of active
dimensions in the data set. If you have already made a call to
getActiveDimenions, it would be more efficient to call
returnedArray.length on the returned array rather than calling this
method, but you will get the same answer either way.
- Returns:
- numActiveDimenions as an int
getActiveDimensionData
public DimensionalData getActiveDimensionData(int index)
- This method is another getActive***() method. It returns a
DimensionalData object based in the index passed to it. The index is
the nth active dimenions. For example, if dimensions 0,1,3, and 4 are
active, a call with index value of 2 will return the dimensional data
object for the 3rd dimension.
- Parameters:
- index - nth active dimension to return DimansionalData of.
- Returns:
- DimensionalData object of the specified active index
getActiveDataPoint
public double[] getActiveDataPoint(int index)
- This method will return an exact sized double array with the values of
a data point that are within active dimensions. This method is not as
efficient as getDatapoint(). Each call to this function makes a call to
getActiveDimensions(). It may be beneficial to deal with active
dimensions at a different level if efficiency is a concern. A single
call to getActiveDimensions() and calls to getDataPoint() and checking
only the active dimensions could improve efficiency since there is only
one call to getActiveDimensions().
- Parameters:
- index - index of point to return.
- Returns:
- activePoint double array of length numActiveDimensions.
getNumDataPoints
public int getNumDataPoints()
- Gets the number of data points in the dataPoints array.
- Returns:
- number of data points in numDataPoints vector
getNumDimensions
public int getNumDimensions()
- Returns the total number of dimensions whether they are active or not.
- Returns:
- value of numDimensions
getDimensionData
public DimensionalData getDimensionData(int index)
- Returns the specified dimensions
- Parameters:
- index - index in vector of the dimension
- Returns:
- specified DimensionalData object
addDimension
public int addDimension(DimensionalData newDimensionData)
- Will add a DimensionalData object to the end the dimensionData vector.
Each element in the dimensionData vector represents a different dimension
and contains information such as its name, cardinality, active state, and
more.
- Parameters:
- newDimensionData - object to add to vector
- Returns:
- index in Vector where object was placed.
clone
public Object clone()
- This allows this class to be cloned
- Returns:
- clone of this object;
null if error occurred
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index