public class DataSetBuilder
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
DataSetBuilder.DataSetResolver
this was introduced to avoid properties where BUNDLE_1 would temporarily hold the name.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROP_VALIDMAX |
static java.lang.String |
PROP_VALIDMIN |
static java.lang.String |
UNRESOLVED_PROP_QDATASET |
protected double |
validMax |
protected double |
validMin |
| Constructor and Description |
|---|
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.
|
DataSetBuilder(int rank,
int guessRecCount,
int dim1)
Create a new builder for a rank 2 dataset.
|
DataSetBuilder(int rank,
int guessRecCount,
int dim1,
int dim2)
Create a new builder for a rank 3 dataset.
|
DataSetBuilder(int rank,
int guessRecCount,
int dim1,
int dim2,
int dim3)
Create a new builder for a rank 4 dataset.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a PropertyChangeListener to the listener list.
|
DDataSet |
getDataSet()
returns the result dataset, concatenating all the datasets it has built thus far, including the partial record.
|
double |
getFillValue()
Getter for property fillValue.
|
int |
getLength()
return the number of records added to the builder.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
get a map of all the properties set thus far.
|
int |
getRecCount()
return the number of records accepted into this builder, and the length of the dataset
if getDataSet is called.
|
int |
getRecordElements()
return the number of elements in each record.
|
Units |
getUnits(int i)
get the units for the column.
|
double |
getValidMax() |
double |
getValidMin() |
double |
getValue(int index0)
for index0==-1, return the last value entered into the rank 1 dataset.
|
void |
nextRecord()
This must be called each time a record is complete.
|
void |
nextRecord(Datum v)
add the double to the rank 1 builder.
|
void |
nextRecord(DatumVector v)
Use the DatumVector to fill the record.
|
void |
nextRecord(double v)
add the double to the rank 1 builder.
|
void |
nextRecord(double[] values)
In one step, specify all the values of the record and advance the counter.
|
void |
nextRecord(java.lang.Object... values)
In one step, specify all the values of the record and advance the counter.
|
void |
nextRecord(QDataSet v)
rank 0 datasets can be used to build the rank 1 datasets
|
void |
nextRecord(java.lang.String s)
add the string to the rank 1 builder, which will be parsed internally.
|
void |
nextRecords(QDataSet ds)
add each of the records of ds to the builder.
|
void |
putProperty(java.lang.String string,
java.lang.Object o)
add the property to the dataset
|
void |
putUnresolvedProperty(java.lang.String type,
java.lang.String pname,
java.lang.String svalue)
mark the property as unresolved, for reference later.
|
void |
putValue(int index0,
Datum d)
insert a value into the builder.
|
void |
putValue(int index0,
double d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
Datum d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
double d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
int index2,
Datum d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
int index2,
double d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
int index2,
int index3,
Datum d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
int index2,
int index3,
double d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
int index2,
int index3,
QDataSet d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
int index2,
QDataSet d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
QDataSet d)
insert a value into the builder.
|
void |
putValue(int index0,
int index1,
java.lang.String s)
insert a value into the builder, parsing the string with the column units.
|
void |
putValue(int index0,
QDataSet d)
insert a value into the builder.
|
void |
putValue(int index0,
java.lang.String s)
insert a value into the builder, parsing the string with the units.
|
void |
putValues(int index0,
QDataSet values,
int count)
copy the elements from one DDataSet into the builder (which can be done with
a system call), ignoring dataset geometry.
|
int |
rank()
return the rank of the dataset we are building.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a PropertyChangeListener from the listener list.
|
void |
resolveProperty(java.lang.String svalue,
java.lang.Object value)
we now know the value, so resolve any unresolved properties containing the
string representation.
|
void |
setDataSetResolver(DataSetBuilder.DataSetResolver dataSetResolver)
add dataset resolved.
|
void |
setFillValue(double fillValue)
Setter for property fillValue.
|
void |
setLabel(int i,
java.lang.String label)
set the label (short, descriptive label for human consumption)
for the column, for rank 2 bundle datasets.
|
void |
setName(int i,
java.lang.String name)
set the name (valid Jython identifier) for the column.
|
void |
setUnits(int i,
Units u)
set the units for column i.
|
void |
setUnits(Units u)
set the units for the dataset.
|
void |
setValidMax(double validMax)
set the valid max property.
|
void |
setValidMin(double validMin) |
java.lang.String |
toString() |
public static final java.lang.String UNRESOLVED_PROP_QDATASET
protected double validMin
public static final java.lang.String PROP_VALIDMIN
protected double validMax
public static final java.lang.String PROP_VALIDMAX
public DataSetBuilder(int rank)
rank - the number of indeces of the result dataset.public DataSetBuilder(int rank,
int guessRecCount)
rank - must be 1.guessRecCount - initial allocation for the first dimension.public DataSetBuilder(int rank,
int guessRecCount,
int dim1)
rank - must be 2.guessRecCount - initial allocation for the first dimension.dim1 - fixed size of the second index.public DataSetBuilder(int rank,
int guessRecCount,
int dim1,
int dim2)
rank - must be 3.guessRecCount - initial allocation for the first dimension.dim1 - fixed size of the second index.dim2 - fixed size of the third index.public DataSetBuilder(int rank,
int guessRecCount,
int dim1,
int dim2,
int dim3)
rank - must be 4.guessRecCount - initial allocation for the first dimension.dim1 - fixed size of the second index.dim2 - fixed size of the third index.dim3 - fixed size of the fourth index.public double getValue(int index0)
index0 - java.lang.IllegalArgumentException - if the index is not -1java.lang.IllegalArgumentException - if nothing is yet written to the builder.public void putValue(int index0,
double d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.d - the value to insert.public void putValue(int index0,
int index1,
double d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexd - the value to insert.public void putValue(int index0,
int index1,
int index2,
double d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexindex2 - the third indexd - the value to insert.public void putValue(int index0,
int index1,
int index2,
int index3,
double d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexindex2 - the third indexindex3 - the third indexd - the value to insert.public void putValue(int index0,
Datum d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.d - the value to insert.public void putValue(int index0,
int index1,
Datum d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexd - the value to insert.public void putValue(int index0,
int index1,
int index2,
Datum d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexindex2 - the third indexd - the value to insert.public void putValue(int index0,
int index1,
int index2,
int index3,
Datum d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexindex2 - the third indexindex3 - the fourth indexd - the value to insert.public void putValue(int index0,
QDataSet d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.d - the value to insert.public void putValue(int index0,
int index1,
QDataSet d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexd - the rank 0 dataset value to insert.public void putValue(int index0,
int index1,
int index2,
QDataSet d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexindex2 - the third indexd - the value to insert.public void putValue(int index0,
int index1,
int index2,
int index3,
QDataSet d)
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexindex2 - the third indexindex3 - the fourth indexd - the value to insert.public void putValue(int index0,
java.lang.String s)
throws java.text.ParseException
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.java.text.ParseExceptionfor the logic interpreting Strings.public void putValue(int index0,
int index1,
java.lang.String s)
throws java.text.ParseException
index0 - The index to insert the data, or if -1, ignore and nextRecord() should be used.index1 - the second indexs - the a string representation of the value parse and insert.java.text.ParseExceptionfor the logic interpreting Strings.public void putValues(int index0,
QDataSet values,
int count)
index0 - The index to put the values, or -1 for the current position.values - rank 1 dataset.count - the number of elements to copyto insert multiple records at once.public void nextRecord()
which inserts all values at once.public void nextRecord(double[] values)
values - the record values.nextRecord(java.lang.Object...)public void nextRecords(QDataSet ds)
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.ds - dataset with rank N, where N is the rank of this builder.public void nextRecord(java.lang.Object... values)
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 ]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()
values - the record values, in an String, Datum, Rank 0 QDataSet, or Number.public void nextRecord(DatumVector v)
v - public void nextRecord(QDataSet v)
v - rank 0 or rank 1 datasetpublic void nextRecord(double v)
v - the valuepublic void nextRecord(java.lang.String s)
s - java.lang.IllegalArgumentException - if the string cannot be parsed.public void nextRecord(Datum v)
v - the valuepublic int getLength()
public int getRecordElements()
public DDataSet getDataSet()
public void putProperty(java.lang.String string,
java.lang.Object o)
string - name like QDataSet.UNITSo - the valuepublic void putUnresolvedProperty(java.lang.String type,
java.lang.String pname,
java.lang.String svalue)
type - the property type, if qdataset this is resolved with dataSetResolver.pname - the property name ("gain")svalue - the arbitrary reference ("gain_04")public void resolveProperty(java.lang.String svalue,
java.lang.Object value)
svalue - the string referencevalue - the object valuepublic void setUnits(Units u)
u - public void setUnits(int i,
Units u)
i - the column numberu - the units for the columnpublic Units getUnits(int i)
i - java.lang.IllegalArgumentException - if the bundle has not been initialized.java.lang.IllegalArgumentException - if the rankpublic void setLabel(int i,
java.lang.String label)
i - the column numberlabel - the label for the columnpublic void setName(int i,
java.lang.String name)
i - the column numbername - the name (valid Jython identifier) for the column.public java.util.Map<java.lang.String,java.lang.Object> getProperties()
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
l - The listener to add.public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
l - The listener to remove.public double getFillValue()
public void setFillValue(double fillValue)
fillValue - New value of property fillValue.public double getValidMin()
public void setValidMin(double validMin)
public double getValidMax()
public void setValidMax(double validMax)
validMax - public int getRecCount()
public java.lang.String toString()
toString in class java.lang.Objectpublic int rank()
public void setDataSetResolver(DataSetBuilder.DataSetResolver dataSetResolver)
dataSetResolver -