net.jbeans.j3d.data
Class DoubleArray

java.lang.Object
  extended bynet.jbeans.j3d.data.DataArray
      extended bynet.jbeans.j3d.data.DoubleArray

public class DoubleArray
extends DataArray

DoubleArray is an array of double numbers.

Version:
$Revision: 1.3 $
Author:
Masahiro Takatsuka (masa@jbeans.net)
See Also:
DataArray

Field Summary
 
Fields inherited from class net.jbeans.j3d.data.DataArray
array, dimension, maxId, size, tupleT
 
Constructor Summary
DoubleArray()
           
DoubleArray(DataArray da)
           
DoubleArray(int dim)
          Construct a new DoubleArray object.
 
Method Summary
 boolean allocate(int size)
          Allocate memory for this array.
 void copy(DataArray da)
           
 int getDataType()
          Get the data type.
 double getElement(int i, int j)
          Return the data element at the ith tuple and jth element location.
 double[] getTuple(int i)
          Get a copy of a tuple at the ith location.
 void getTuple(int i, double[] tuple)
          Copy the tuple value into a user-provided array.
 double getValue(int id)
          Get the data at a particular index.
 void insertElement(int i, int j, double e)
          Insert the data element at ith tuple and jth element location.
 int insertNextTuple(double[] tuple)
          Insert (memory allocation performed) the tuple onto the end of the array.
 int insertNextValue(double i)
          Insert data at the end of the array.
 void insertTuple(int i, double[] tuple)
          Insert (memory allocation performed) the tuple into the ith location in the array.
 void insertValue(int id, double i)
          Insert data at a specified position in the array.
 DataArray makeObject()
          Virtual constructor creates object of same type as this object.
protected  java.lang.Object resize(int size)
          resize the array.
 void setArray(double[] array)
          This method lets the user specify data to be held by the array.
 void setElement(int i, int j, double e)
          Set the data element at the ith tuple and jth element location.
 void setNumberOfTuples(int number)
          Set the number of n-tuples in the array.
 void setNumberOfValues(int number)
          Specify the number of values for this object to hold.
 void setTuple(int i, double[] tuple)
          Set the tuple value at the ith location in the array.
 void setValue(int id, double value)
          Set the data at a particular index.
 
Methods inherited from class net.jbeans.j3d.data.DataArray
ensureSpace, getData, getData, getDimension, getMaxId, getNumberOfTuples, getSize, initialize, reset, setDimension, squeeze
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleArray

public DoubleArray(int dim)
Construct a new DoubleArray object.
 

Parameters:
dim - the dimension of the tuple.

DoubleArray

public DoubleArray()

DoubleArray

public DoubleArray(DataArray da)
Method Detail

copy

public void copy(DataArray da)
Overrides:
copy in class DataArray

makeObject

public DataArray makeObject()
Virtual constructor creates object of same type as this object.

Specified by:
makeObject in class DataArray

setArray

public void setArray(double[] array)
This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to true to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy the data from the suppled array.

Parameters:
array -

resize

protected java.lang.Object resize(int size)
resize the array.

Specified by:
resize in class DataArray

allocate

public boolean allocate(int size)
Allocate memory for this array. Delete old storage only if necessary.

Specified by:
allocate in class DataArray

getDataType

public int getDataType()
Get the data type.

Overrides:
getDataType in class DataArray
Returns:
the underlying data type.

setNumberOfTuples

public void setNumberOfTuples(int number)
Set the number of n-tuples in the array.

Specified by:
setNumberOfTuples in class DataArray
Parameters:
number -
Returns:
void

getTuple

public double[] getTuple(int i)
Get a copy of a tuple at the ith location.

Specified by:
getTuple in class DataArray
Parameters:
i -
Returns:
an array containing tuple.

getTuple

public void getTuple(int i,
                     double[] tuple)
Copy the tuple value into a user-provided array.

Specified by:
getTuple in class DataArray
Parameters:
i -
tuple -
Returns:
void

setTuple

public void setTuple(int i,
                     double[] tuple)
Set the tuple value at the ith location in the array.

Specified by:
setTuple in class DataArray
Parameters:
i -
tuple -
Returns:
void

insertTuple

public void insertTuple(int i,
                        double[] tuple)
Insert (memory allocation performed) the tuple into the ith location in the array.

Specified by:
insertTuple in class DataArray
Parameters:
i -
tuple -
Returns:
void

insertNextTuple

public int insertNextTuple(double[] tuple)
Insert (memory allocation performed) the tuple onto the end of the array.

Specified by:
insertNextTuple in class DataArray
Parameters:
tuple -
Returns:
the location at which the data was inserted.

getValue

public double getValue(int id)
Get the data at a particular index.


setValue

public void setValue(int id,
                     double value)
Set the data at a particular index. Does not do range checking. Make sure you use the method SetNumberOfValues() before inserting data.


setNumberOfValues

public void setNumberOfValues(int number)
Specify the number of values for this object to hold. Does an allocation as well as setting the maxId ivar. Used in conjunction with setValue() method for fast insertion.


insertValue

public void insertValue(int id,
                        double i)
Insert data at a specified position in the array.


insertNextValue

public int insertNextValue(double i)
Insert data at the end of the array. Return its location in the array.


getElement

public double getElement(int i,
                         int j)
                  throws java.lang.ArrayIndexOutOfBoundsException
Return the data element at the ith tuple and jth element location. Note that i is less than number of tuples and j is less than the dimension.
 

Overrides:
getElement in class DataArray
Parameters:
i - the index to the ith tuple.
j - the index to the jth element of the tuple.
Returns:
element.
Throws:
java.lang.ArrayIndexOutOfBoundsException

setElement

public void setElement(int i,
                       int j,
                       double e)
                throws java.lang.ArrayIndexOutOfBoundsException
Set the data element at the ith tuple and jth element location. Note that i is less than number of tuples and j is less than the dimension.
 

Overrides:
setElement in class DataArray
Parameters:
i - the index to the ith tuple.
j - the index to the jth element of the tuple.
e - the element to be set.
Returns:
void
Throws:
java.lang.ArrayIndexOutOfBoundsException

insertElement

public void insertElement(int i,
                          int j,
                          double e)
                   throws java.lang.ArrayIndexOutOfBoundsException
Insert the data element at ith tuple and jth element location.
 

Overrides:
insertElement in class DataArray
Returns:
void
Throws:
java.lang.ArrayIndexOutOfBoundsException


Copyright © 1995-2004 net.jbeans. All Rights Reserved.