## org.das2.qds.util.DataSetBuilder

allows dataset of unknown length to be built. Presently, this only builds QUBES, but should allow for geometry changes. TODO: consider using WritableDataSet interface. The guessRecCount parameter is the initial number of allocated records, and is also the extension when this number of records is passed. The final physical dataset size is not affected by this, because the data is copied.

## DataSetBuilder( int rank )

Create a new builder for a rank 0 dataset.

## DataSetBuilder( int rank, int guessRecCount )

Create a new builder for a rank 1 dataset. guessRecCount is the guess of dim0 size. Bad guesses will simply result in an extra array copy.

## DataSetBuilder( int rank, int guessRecCount, int dim1 )

Create a new builder for a rank 2 dataset. guessRecCount is the guess of dim0 size. Bad guesses will simply result in an extra array copy.

## DataSetBuilder( int rank, int guessRecCount, int dim1, int dim2 )

Create a new builder for a rank 3 dataset. guessRecCount is the guess of dim0 size. Bad guesses will simply result in an extra array copy.

## DataSetBuilder( int rank, int guessRecCount, int dim1, int dim2, int dim3 )

Create a new builder for a rank 4 dataset. guessRecCount is the guess of dim0 size. Bad guesses will simply result in an extra array copy.

## UNRESOLVED_PROP_QDATASET

## PROP_VALIDMIN

## PROP_VALIDMAX

## addPropertyChangeListener

addPropertyChangeListener( java.beans.PropertyChangeListener l ) → void

Adds a PropertyChangeListener to the listener list.

### Parameters

l - The listener to add.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getDataSet

getDataSet( ) → org.das2.qds.DDataSet

returns the result dataset, concatenating all the datasets it has built thus far, including the partial record. See https://sourceforge.net/p/autoplot/bugs/1469/ which considers if the partial record should be included. Clients should always call nextRecord on all completed records in case the logic changes. See also the AsciiParser, which has special code for handling the partial record.

### Returns:

the result dataset
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getFillValue

getFillValue( ) → double

Getter for property fillValue.

### Returns:

Value of property fillValue.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getLength

getLength( ) → int

return the number of records added to the builder.

### Returns:

the number of records added to the builder.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getProperties

getProperties( ) → java.util.Map

get a map of all the properties set thus far.

### Returns:

a java.util.Map
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getRecCount

getRecCount( ) → int

return the number of records accepted into this builder, and the length of the dataset if getDataSet is called.

### Returns:

the number of records accepted into this builder
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getRecordElements

getRecordElements( ) → int

return the number of elements in each record.

### Returns:

the number of elements in each record.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getUnits

getUnits( int i ) → Units

get the units for the column.

### Parameters

i - an int

### Returns:

the units or null.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getValidMax

getValidMax( ) → double

### Returns:

double
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getValidMin

getValidMin( ) → double

### Returns:

double
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getValue

getValue( int index0 ) → double

for index0==-1, return the last value entered into the rank 1 dataset.

### Parameters

index0 - an int

### Returns:

a double
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( ) → void

This must be called each time a record is complete. Note this currently advances to the next record and at this point the next record exists. In other words, the last call to nextRecord is not required. This logic may change, so that any fields written would be dropped unless nextRecord is called to commit the record. When -1 is used for the indexes of the streaming dimension, then this will increment the internal counter. TODO: Check for unspecified entries.

### Returns:

void (returns nothing)

### See Also:

nextRecord(java.lang.Object...) which inserts all values at once.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( double[] values ) → void

In one step, specify all the values of the record and advance the counter. This is intended to reduce the number of lines needed in scripts, and to support Jython where a double array would not be cast to an Object array. Also, columns 1..N-1 are declared dependent on column 0, when column 0 is UT times.

### Parameters

values - the record values.

### Returns:

void (returns nothing)

### See Also:

nextRecord(java.lang.Object...)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( Object[] values ) → void

In one step, specify all the values of the record and advance the counter. This is intended to reduce the number of lines needed in scripts. In Jython:

>     dsb= DataSetBuilder(2,100,2)
>     dsb.nextRecord( [ '2014-001T00:00', 20. ] )
>     dsb.nextRecord( [ '2014-002T00:00', 21. ] )
>     dsb.nextRecord( [ '2014-003T00:00', 21.4 ] )
>     dsb.nextRecord( [ '2014-004T00:00', 19.7 ] )
>     ds= dsb.getDataSet()

Also, columns 1..N-1 are declared dependent on column 0, when column 0 is UT times. Note an events record is also supported, with [ tstart, tstop, Color, msg ]

### Parameters

values - the record values, in an String, Datum, Rank 0 QDataSet, or Number.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( org.das2.datum.DatumVector v ) → void

Use the DatumVector to fill the record. DatumVectors can have just one unit.

### Parameters

v - a DatumVector

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( QDataSet v ) → void

rank 0 datasets can be used to build the rank 1 datasets

### Parameters

v - rank 0 or rank 1 dataset

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( double v ) → void

add the double to the rank 1 builder.

### Parameters

v - the value

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( String s ) → void

add the string to the rank 1 builder, which will be parsed internally.

### Parameters

s - a String

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecord

nextRecord( Datum v ) → void

add the double to the rank 1 builder.

### Parameters

v - the value

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## nextRecords

nextRecords( QDataSet ds ) → void

add each of the records of ds to the builder. This is somewhat equivalent to:

     for d in ds: dsb.nextRecord(d)

(Note the above only works when ds is rank 1.) Though this is equivalent, this is provided because a future implementation may peek at the dataset to transfer data more efficiently.

### Parameters

ds - dataset with rank N, where N is the rank of this builder.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putProperty

putProperty( String string, Object o ) → void

add the property to the dataset

### Parameters

string - name like QDataSet.UNITS
o - the value

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putUnresolvedProperty

putUnresolvedProperty( String type, String pname, String svalue ) → void

mark the property as unresolved, for reference later. This was added for the QStream reader, which doesn't resolve

### Parameters

type - the property type, if qdataset this is resolved with dataSetResolver.
pname - the property name ("gain")
svalue - the arbitrary reference ("gain_04")

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, double d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, double d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, int index2, double d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
index2 - the third index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, int index2, int index3, double d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
index2 - the third index
index3 - the third index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, Datum d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, Datum d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, int index2, Datum d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
index2 - the third index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, int index2, int index3, Datum d ) → void

insert a value into the builder.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
index2 - the third index
index3 - the fourth index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, QDataSet d ) → void

insert a value into the builder. Note these do Units checking and are therefore less efficient

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, QDataSet d ) → void

insert a value into the builder. Note these do Units checking and are therefore less efficient

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
d - the rank 0 dataset value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, int index2, QDataSet d ) → void

insert a value into the builder. Note these do Units checking and are therefore less efficient

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
index2 - the third index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, int index2, int index3, QDataSet d ) → void

insert a value into the builder. Note these do Units checking and are therefore less efficient

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
index2 - the third index
index3 - the fourth index
d - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, String s ) → void

insert a value into the builder, parsing the string with the units.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
s - the a string representation of the value parse and insert.

### Returns:

void (returns nothing)

### See Also:

Ops#dataset(java.lang.Object) for the logic interpreting Strings.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( int index0, int index1, String s ) → void

insert a value into the builder, parsing the string with the column units.

### Parameters

index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.
index1 - the second index
s - the a string representation of the value parse and insert.

### Returns:

void (returns nothing)

### See Also:

Ops#dataset(java.lang.Object) for the logic interpreting Strings.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValues

putValues( int index0, QDataSet values, int count ) → void

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. This should only be used to insert one record (with multiple values) at a time. Note this does not increment the current index, and nextRecord must be called to move to the next index.

### Parameters

index0 - The index to put the values, or -1 for the current position.
values - rank 1 dataset.
count - the number of elements to copy

### Returns:

void (returns nothing)

### See Also:

nextRecords(QDataSet) to insert multiple records at once.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## rank

rank( ) → int

return the rank of the dataset we are building.

### Returns:

the rank of the dataset we are building
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## removePropertyChangeListener

removePropertyChangeListener( java.beans.PropertyChangeListener l ) → void

Removes a PropertyChangeListener from the listener list.

### Parameters

l - The listener to remove.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## resolveProperty

resolveProperty( String svalue, Object value ) → void

we now know the value, so resolve any unresolved properties containing the string representation. Note the entry is left in the unresolved properties.

### Parameters

svalue - the string reference
value - the object value

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setDataSetResolver

setDataSetResolver( org.das2.qds.util.DataSetBuilder.DataSetResolver dataSetResolver ) → void

add dataset resolved.

### Parameters

dataSetResolver - a DataSetBuilder.DataSetResolver

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setFillValue

setFillValue( double fillValue ) → void

Setter for property fillValue.

### Parameters

fillValue - New value of property fillValue.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setLabel

setLabel( int i, String label ) → void

set the label (short, descriptive label for human consumption) for the column, for rank 2 bundle datasets.

### Parameters

i - the column number
label - the label for the column

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setName

setName( int i, String name ) → void

set the name (valid Jython identifier) for the column.

### Parameters

i - the column number
name - the name (valid Jython identifier) for the column.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setNameLabelUnits

setNameLabelUnits( int i, String name, String label, Units u ) → void

convenient one-liner to set all at once.

### Parameters

i - the column number for rank 2 bundle
name - the name of the column
label - the label for the column
u - the units for the column

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setUnits

setUnits( Units u ) → void

set the units for the dataset.

### Parameters

u - an Units

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setUnits

setUnits( int i, Units u ) → void

set the units for column i. This is only used with rank 2 (2-index) datasets.

### Parameters

i - the column number
u - the units for the column

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setValidMax

setValidMax( double validMax ) → void

set the valid max property.

### Parameters

validMax - a double

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setValidMin

setValidMin( double validMin ) → void

### Parameters

validMin - a double

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## toString

toString( ) → String

### Returns:

java.lang.String
[search for examples] [view on GitHub] [view on old javadoc] [view source]