iicm.vrml.pwutils
Class DoubleArray

java.lang.Object
  |
  +--iicm.vrml.pwutils.DoubleArray

public class DoubleArray
extends java.lang.Object

DoubleArray - dynamic array of double type values better time and memory efficiency than Vector, double[] accessible in native code Copyright (c) 1996 IICM


Constructor Summary
DoubleArray()
          create with default length
DoubleArray(double[] dat)
          copy initial data from another double[].
DoubleArray(DoubleArray dat)
          copy initial data from another DoubleArray (non-null). do not use the above constructor in this case, as it would use all values, not just the used length (count); again: values are *copied*
DoubleArray(int len)
          create with initial buffer length
 
Method Summary
 void append(double d)
          append one double element
 void append(double[] d, int num)
          append several double elements
 boolean clearData()
          clear the array
 int getCount()
          get count of used array members.
 double[] getData()
          get data array.
 double[] getTrimmedArray()
          get data array with proper length.
 void setData(double[] dat)
          copy data from a double[]
 void setData(double[] dat, int n)
          copy first n elements of a double[]
 void setData(DoubleArray dat)
          copy data from another DoubleArray
 void setSize(int n)
          set number of used array elements (ensures there is enough storage)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleArray

public DoubleArray()
create with default length

DoubleArray

public DoubleArray(int len)
create with initial buffer length

DoubleArray

public DoubleArray(double[] dat)
copy initial data from another double[]. To say it again: values in double[] are *copied* and not just referenced by this class

DoubleArray

public DoubleArray(DoubleArray dat)
copy initial data from another DoubleArray (non-null). do not use the above constructor in this case, as it would use all values, not just the used length (count); again: values are *copied*
Method Detail

setData

public void setData(DoubleArray dat)
copy data from another DoubleArray

setData

public void setData(double[] dat)
copy data from a double[]

setData

public void setData(double[] dat,
                    int n)
copy first n elements of a double[]

getCount

public final int getCount()
get count of used array members. Note: may be smaller than data_.length

getData

public final double[] getData()
get data array. Only elements 0 to (getCount () - 1) were set by user. Subsequent calls (after enlargement) may return a different array object

getTrimmedArray

public final double[] getTrimmedArray()
get data array with proper length. May involve copying

append

public void append(double d)
append one double element

append

public void append(double[] d,
                   int num)
append several double elements

setSize

public void setSize(int n)
set number of used array elements (ensures there is enough storage)

clearData

public boolean clearData()
clear the array
Returns:
true if the array was previously non-empty