iicm.vrml.pwutils
Class FloatArray

java.lang.Object
  extended by iicm.vrml.pwutils.FloatArray

public class FloatArray
extends java.lang.Object

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

Version:
0.1, latest change: 1 Okt 96
Author:
Michael Pichler, Karin Roschker, (based on Field macro by Gerald Pani)

Field Summary
private  int count_
           
private  float[] data_
           
 
Constructor Summary
FloatArray()
          create with default length
FloatArray(float[] dat)
          copy initial data from another float[].
FloatArray(FloatArray dat)
          copy initial data from another FloatArray (non-null).
FloatArray(int len)
          create with initial buffer length
 
Method Summary
 void append(float d)
          append one float element
 boolean clearData()
          clear the array
private  void enlarge(int newsize)
          enlarge the data array to its new size; does not change count_
 int getCount()
          get count of used array members.
 float[] getData()
          get data array.
 void setData(float[] dat)
          copy data from a float[]
 void setData(float[] dat, int n)
          copy first n elements of a float[]
 void setData(FloatArray dat)
          copy data from another FloatArray
 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
 

Field Detail

data_

private float[] data_

count_

private int count_
Constructor Detail

FloatArray

public FloatArray()
create with default length


FloatArray

public FloatArray(int len)
create with initial buffer length


FloatArray

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


FloatArray

public FloatArray(FloatArray dat)
copy initial data from another FloatArray (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(FloatArray dat)
copy data from another FloatArray


setData

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


setData

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


getCount

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


getData

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


append

public void append(float d)
append one float element


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

enlarge

private void enlarge(int newsize)
enlarge the data array to its new size; does not change count_