|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jbeans.j3d.data.DataArray
DataArray is an superclass for all net.jbeans.j3d.data array objects.
Subclasses of this class handle specific primitive data (boolean, bit,
char, short, int, long, float, double, String.)
The data structure of DataArray is an array of tuples.
Each tuple is a n-dimensional array. DataArray also can be seen as
a m x n
matrix, where m is the number of tuples, and n is the
number of dimension in a tuple. the DataArray can be used to
represent various data such as scalars, vectors, texture coordinates,
tensors...
The Visualization Toolkit (VTK)'s data model was used to create this class
and associated subclasses.
Field Summary | |
protected java.lang.Object |
array
|
protected int |
dimension
|
protected int |
maxId
|
protected int |
size
|
protected double[] |
tupleT
|
Constructor Summary | |
DataArray(DataArray da)
|
|
DataArray(int dim)
Construct a DataArray object with the specified tuple dimension. |
Method Summary | |
abstract boolean |
allocate(int size)
|
void |
copy(DataArray da)
|
java.lang.Object |
ensureSpace(int id,
int number)
ensures data is allocated from the location id
for the number of items requested. |
java.lang.Object |
getData()
Return a array pointer. |
void |
getData(int tupleMin,
int tupleMax,
int eleMin,
int eleMax,
DataArray data)
Get the data as a double array in the range (tupleMin,tupleMax) and (compMin, compMax). |
int |
getDataType()
Return the underlying data type. |
int |
getDimension()
Get the dimension (n) of the elements. |
double |
getElement(int i,
int j)
Return the data element at the i th tuple and
j th element location. |
int |
getMaxId()
What is the maximum id currently in the array. |
int |
getNumberOfTuples()
Get the number of tuples (a element group) in the array. |
int |
getSize()
Return the size of the data. |
abstract double[] |
getTuple(int i)
Get the data tuple at i th location. |
abstract void |
getTuple(int i,
double[] tuple)
Get the data tuple at i th location by filling in a
user-provided array. |
void |
initialize()
Release storage and reset array to initial state. |
void |
insertElement(int i,
int j,
double e)
Insert the data element at i th tuple and
j th element location. |
abstract int |
insertNextTuple(double[] tuple)
Insert the data tuple at the end of the array and return the location at which the data was inserted. |
abstract void |
insertTuple(int i,
double[] tuple)
Insert the data tuple at i th location. |
abstract DataArray |
makeObject()
Virtual constructor creates an object of the same type as this one. |
void |
reset()
Reset to an empty state, without freeing any memory. |
protected abstract java.lang.Object |
resize(int size)
resize the array. |
void |
setDimension(int dim)
Set the dimension (n). |
void |
setElement(int i,
int j,
double e)
Set the data element at the i th tuple and
j th element location. |
abstract void |
setNumberOfTuples(int number)
Set the number of tuples (a element group) in the array. |
abstract void |
setTuple(int i,
double[] tuple)
Set the data tuple at i th location. |
void |
squeeze()
Resize object to just fit data requirement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Object array
protected int size
protected int maxId
protected int dimension
protected double[] tupleT
Constructor Detail |
public DataArray(int dim)
dim
- the dimension of the tuple.public DataArray(DataArray da)
Method Detail |
public void copy(DataArray da)
public abstract boolean allocate(int size)
public void initialize()
public abstract DataArray makeObject()
public java.lang.Object getData()
protected abstract java.lang.Object resize(int size)
public int getDataType()
public void squeeze()
public void reset()
public int getSize()
public int getMaxId()
public java.lang.Object ensureSpace(int id, int number)
id
for the number of items requested. Set maxId according to the
number of data values requested.
public double getElement(int i, int j) throws java.lang.ArrayIndexOutOfBoundsException
i
th tuple and
j
th element location.
Note that i
is less than number of tuples and
j
is less than the dimension. This method can be
overridden for more efficiency.
i
- the index to the i
th tuple.j
- the index to the j
th element of the tuple.
java.lang.ArrayIndexOutOfBoundsException
public void setElement(int i, int j, double e) throws java.lang.ArrayIndexOutOfBoundsException
i
th tuple and
j
th element location.
Note that i
is less than number of tuples and
j
is less than the dimension.
i
- the index to the i
th tuple.j
- the index to the j
th element of the tuple.e
- the element to be set.
java.lang.ArrayIndexOutOfBoundsException
public void insertElement(int i, int j, double e) throws java.lang.ArrayIndexOutOfBoundsException
i
th tuple and
j
th element location.
java.lang.ArrayIndexOutOfBoundsException
public void setDimension(int dim)
public int getDimension()
public void getData(int tupleMin, int tupleMax, int eleMin, int eleMax, DataArray data)
tupleMin
- tupleMax
- eleMin
- eleMax
-
public abstract void getTuple(int i, double[] tuple)
i
th location by filling in a
user-provided array. Make sure that your array is large enough to hold
number of elements being returned.
i
- tuple
-
public abstract void setTuple(int i, double[] tuple)
i
th location.
Note that range checking is not performed; use this method in
conjunction with setNumberOfTuples() to allocate space.
i
- tuple
-
public abstract void insertTuple(int i, double[] tuple)
i
th location.
Note that memory allocation is performed as necessary to hold the data.
i
- tuple
-
public abstract int insertNextTuple(double[] tuple)
tuple
-
public abstract void setNumberOfTuples(int number)
number
- the number of tuples.
public int getNumberOfTuples()
public abstract double[] getTuple(int i)
i
th location. Return it as an array.
i
- the index of the i
th tuple.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |