org.virbo.dsutil
Class DataSetBuilder

java.lang.Object
  extended by org.virbo.dsutil.DataSetBuilder

public class DataSetBuilder
extends java.lang.Object

allows dataset of unknown length to be built. Presently, this only builds QUBES, but should allow for geometry changes. TODO: consider using WritableDataSet interface.


Field Summary
static java.lang.String PROP_VALIDMAX
           
static java.lang.String PROP_VALIDMIN
           
protected  double validMax
           
protected  double validMin
           
 
Constructor Summary
DataSetBuilder(int rank, int recCount)
          recCount is the guess of dim0 size.
DataSetBuilder(int rank, int recCount, int dim1)
          recCount is the guess of dim0 size.
DataSetBuilder(int rank, int recCount, int dim1, int dim2)
          recCount is the guess of dim0 size.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a PropertyChangeListener to the listener list.
 DDataSet getDataSet()
          returns the result dataset, concatenating all the datasets it's built thus far.
 double getFillValue()
          Getter for property fillValue.
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
          get a map of all the properties set thus far.
 int getRecordElements()
          return the number of elements in each record.
 double getValidMax()
           
 double getValidMin()
           
 void nextRecord()
          This must be called each time a record is complete.
 void putProperty(java.lang.String string, java.lang.Object o)
           
 void putValue(int index0, double d)
          index0 is ignored!!!
 void putValue(int index0, int index1, double d)
          index0 is ignored!!!
 void putValue(int index0, int index1, int index2, double d)
          index0 is ignored!!!
 void putValues(int index0, DDataSet values, int count)
          copy the elements from one DDataSet into the builder (which can be done with a system call), ignoring dataset geometry.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a PropertyChangeListener from the listener list.
 void setFillValue(double fillValue)
          Setter for property fillValue.
 void setValidMax(double validMax)
           
 void setValidMin(double validMin)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

validMin

protected double validMin

PROP_VALIDMIN

public static final java.lang.String PROP_VALIDMIN
See Also:
Constant Field Values

validMax

protected double validMax

PROP_VALIDMAX

public static final java.lang.String PROP_VALIDMAX
See Also:
Constant Field Values
Constructor Detail

DataSetBuilder

public DataSetBuilder(int rank,
                      int recCount)
recCount is the guess of dim0 size. Bad guesses will result in an extra copy.

Parameters:
recCount - initial allocation for the first dimension.

DataSetBuilder

public DataSetBuilder(int rank,
                      int recCount,
                      int dim1)
recCount is the guess of dim0 size. Bad guesses will result in an extra copy.

Parameters:
recCount - initial allocation for the first dimension.
dim1 - when rank 2 or greater is used.

DataSetBuilder

public DataSetBuilder(int rank,
                      int recCount,
                      int dim1,
                      int dim2)
recCount is the guess of dim0 size. Bad guesses may result in an extra copy.

Parameters:
recCount - initial allocation for the first dimension.
dim1 - when rank 2 or greater is used.
dim2 - when rank 3 or greater is used.
Method Detail

putValue

public void putValue(int index0,
                     double d)
index0 is ignored!!!


putValue

public void putValue(int index0,
                     int index1,
                     double d)
index0 is ignored!!!


putValue

public void putValue(int index0,
                     int index1,
                     int index2,
                     double d)
index0 is ignored!!!


putValues

public void putValues(int index0,
                      DDataSet values,
                      int count)
copy the elements from one DDataSet into the builder (which can be done with a system call), ignoring dataset geometry. TODO: since the element count allows for putting multiple records in at once, an index out of bounds may occur after the last record of current is written.

Parameters:
index0 -
values -
count - the number of elements to copy

nextRecord

public void nextRecord()
This must be called each time a record is complete. TODO: I always forget to call this, find another way to do this. Check for unspecified entries.


getRecordElements

public int getRecordElements()
return the number of elements in each record.

Returns:

getDataSet

public DDataSet getDataSet()
returns the result dataset, concatenating all the datasets it's built thus far.


putProperty

public void putProperty(java.lang.String string,
                        java.lang.Object o)

getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()
get a map of all the properties set thus far.

Returns:

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a PropertyChangeListener to the listener list.

Parameters:
l - The listener to add.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a PropertyChangeListener from the listener list.

Parameters:
l - The listener to remove.

getFillValue

public double getFillValue()
Getter for property fillValue.

Returns:
Value of property fillValue.

setFillValue

public void setFillValue(double fillValue)
Setter for property fillValue.

Parameters:
fillValue - New value of property fillValue.

getValidMin

public double getValidMin()

setValidMin

public void setValidMin(double validMin)

getValidMax

public double getValidMax()

setValidMax

public void setValidMax(double validMax)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object