|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.bristol.star.cdf.Variable
public class Variable
Provides the metadata and record data for a CDF variable.
At construction time, a map of where the records are stored is
constructed, but the record data itself is not read unless or until
one of the read
methods is called.
This interface does not currently support data reading in such
a flexible way as the official CDF interface.
You can read a record's worth of data at a time using either
readRawRecord
(which should be fairly efficient) or
readShapedRecord
(which may have to copy and
possibly re-order the array, and may not be so efficient).
Constructor Summary | |
---|---|
Variable(VariableDescriptorRecord vdr,
CdfInfo cdfInfo,
RecordFactory recFact)
Constructor. |
Method Summary | |
---|---|
java.lang.Object |
createRawValueArray()
Creates a workspace array suitable for use with this variable's reading methods. |
DataType |
getDataType()
Returns the data type of this variable. |
VariableDescriptorRecord |
getDescriptor()
Returns the VariableDescriptorRecord on which this Variable instance is based. |
java.lang.String |
getName()
Returns this variable's name. |
int |
getNum()
Returns the index number within the CDF of this variable. |
int |
getRecordCount()
Returns the upper limit of records that may have values. |
boolean |
getRecordVariance()
Indicates whether this variable has a value which is fixed for all records or can vary per record. |
Shaper |
getShaper()
Returns an object that knows about the array dimensions of the data values. |
java.lang.String |
getSummary()
Returns a short text string describing the type, shape and variance of this variable. |
boolean |
hasRecord(int irec)
Indicates whether a real distinct file-based record exists for the given index. |
boolean |
isZVariable()
Indicates whether this variable is a zVariable or rVariable. |
void |
readRawRecord(int irec,
java.lang.Object rawValueArray)
Reads the data from a single record into a supplied raw value array. |
java.lang.Object |
readShapedRecord(int irec,
boolean rowMajor,
java.lang.Object rawValueArrayWorkspace)
Reads the data from a single record and returns it as an object of a suitable type for this variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Variable(VariableDescriptorRecord vdr, CdfInfo cdfInfo, RecordFactory recFact) throws java.io.IOException
vdr
- variable descriptor record for the variablecdfInfo
- global CDF informationrecFact
- record factory
java.io.IOException
Method Detail |
---|
public java.lang.String getName()
public int getNum()
public boolean isZVariable()
public int getRecordCount()
public DataType getDataType()
public Shaper getShaper()
public boolean getRecordVariance()
public java.lang.String getSummary()
public VariableDescriptorRecord getDescriptor()
public java.lang.Object createRawValueArray()
public boolean hasRecord(int irec) throws java.io.IOException
irec
- record index
java.io.IOException
public void readRawRecord(int irec, java.lang.Object rawValueArray) throws java.io.IOException
The raw value array is as obtained from createRawValueArray()
.
irec
- record indexrawValueArray
- workspace array, as created by the
createRawValueArray
method
java.io.IOException
public java.lang.Object readShapedRecord(int irec, boolean rowMajor, java.lang.Object rawValueArrayWorkspace) throws java.io.IOException
rowMajor
argument, the array elements will be
rordered appropriately.
If some of the dimension variances are false, the values will
be duplicated accordingly.
The Shaper returned from the getShaper()
method
can provide more information on the return value from this method.
The workspace is as obtained from createRawValueArray()
.
irec
- record indexrowMajor
- required majority of output array; true for row major,
false for column major; only has an effect for
dimensionality >=2rawValueArrayWorkspace
- workspace array, as created by the
createRawValueArray
method
rawValueArray
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |