edu.washington.NVisF.dataIO
Class SandPileReader
java.lang.Object
|
+--edu.washington.NVisF.dataIO.DataReader
|
+--edu.washington.NVisF.dataIO.BinaryDataFileReader
|
+--edu.washington.NVisF.dataIO.SandPileReader
- public class SandPileReader
- extends BinaryDataFileReader
The SandPileReader class provides access to binary files in the SS
(solar system) format, without any scale factor applied to the data.
This reader is used for simulations of sand piles, which use the
SS data format.
Method Summary |
int |
getCount(java.lang.String predicate)
returns the number of objects that satisfy the given predicate. |
float[] |
getScalar(java.lang.String predicate,
java.lang.String dataField)
returns an array of floats containing the specified scalar field
element for all data objects that satisfy the given predicate. |
float[][] |
getVector(java.lang.String predicate,
java.lang.String dataField)
returns an array of arrays containing the specified vector field
element for all data objects that satisfy the given predicate. |
void |
initConnection(java.io.InputStream source)
|
void |
loadData(java.lang.String predicate,
java.lang.String[] dataFields)
instructs this DataReader to gather and store the requested data
for later access. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SandPileReader
public SandPileReader()
SandPileReader
public SandPileReader(java.lang.String name)
initConnection
public void initConnection(java.io.InputStream source)
throws DataIOException
- Overrides:
initConnection
in class BinaryDataFileReader
getCount
public int getCount(java.lang.String predicate)
throws java.text.ParseException,
NoConnectionException,
DataIOException
- Description copied from class:
DataReader
- returns the number of objects that satisfy the given predicate.
Note that in the current version, the only predicates supported are
simply the name of a data object.
- Overrides:
getCount
in class BinaryDataFileReader
- Following copied from class:
edu.washington.NVisF.dataIO.DataReader
- Parameters:
predicate
- a string in the query language that identifies
the desired objects- Returns:
- int the number of objects
- Throws:
java.text.ParseException
- if the predicate cannot be parsedNoConnectionException
- if there is no active connectionDataIOException
- if an unexpected error occurs
loadData
public void loadData(java.lang.String predicate,
java.lang.String[] dataFields)
throws java.text.ParseException,
NoConnectionException,
DataIOException
- Description copied from class:
DataReader
- instructs this DataReader to gather and store the requested data
for later access. The first argument identifies what objects to
get data for, and the second identifies what fields to retrieve.
If the second argument is null, then all fields are retrieved.
Using this method may significantly speed up later calls to getData
for this predicate.
Note that in the current version, the only predicates supported are
simply the name of a data object.
This method is not guaranteed to be implemented by all subclasses.
The default implementation is to do nothing.
- Overrides:
loadData
in class BinaryDataFileReader
- Following copied from class:
edu.washington.NVisF.dataIO.DataReader
- Parameters:
predicate
- a string in the query language that identifies
the desired objectsfields
- an array of strings giving the names of the
desired fields- Throws:
java.text.ParseException
- if the predicate cannot be parsedNoConnectionException
- if there is no active connectionDataIOException
- if an unexpected error occurs- See Also:
DataReader.getScalar(java.lang.String, java.lang.String)
,
DataReader.getVector(java.lang.String, java.lang.String)
getScalar
public float[] getScalar(java.lang.String predicate,
java.lang.String dataField)
throws java.text.ParseException,
NoConnectionException,
DataIOException
- Description copied from class:
DataReader
- returns an array of floats containing the specified scalar field
element for all data objects that satisfy the given predicate. The
first argument is a string in the query language specifying the desired
objects, while the second is a string giving the name of the field
to return.
Note that in the current version, the only predicates supported are
simply the name of a data object, and data for all objects of that
type are returned.
This method is not guaranteed to be implemented by all subclasses.
The default implementation throws a DataIOException identifying
the non-implementing class.
A null value is returned if the requested data object type does
not exist, or if the requested data field is not defined as a
scalar field element for that data object type.
- Overrides:
getScalar
in class BinaryDataFileReader
- Following copied from class:
edu.washington.NVisF.dataIO.DataReader
- Parameters:
predicate
- a string in the query language that identifies
the desired objectsdataField
- a string specifying the scalar field to be returned- Returns:
- float[] containing the array of scalars, or null if no
matches were found
- Throws:
java.text.ParseException
- if the predicate cannot be parsedNoConnectionException
- if there is no active connectionDataIOException
- if an unexpected error occurs- See Also:
DataReader.loadData(java.lang.String, java.lang.String[])
getVector
public float[][] getVector(java.lang.String predicate,
java.lang.String dataField)
throws java.text.ParseException,
NoConnectionException,
DataIOException
- Description copied from class:
DataReader
- returns an array of arrays containing the specified vector field
element for all data objects that satisfy the given predicate. That is,
the desired vector is represented as an array of floats (usually
3, for a 3-D system), and the return type is an array of these
arrays with length N, where N is the number of matching data objects.
The first argument is a string in the query language specifying the
desired objects, while the second is a string giving the name of
the field to return.
Note that in the current version, the only predicates supported are
simply the name of a data object, and data for all objects of that
type are returned.
This method is not guaranteed to be implemented by all subclasses.
The default implementation throws a DataIOException identifying
the non-implementing class.
A null value is returned if the requested data object type does
not exist, or if the requested data field is not defined as a
vector field element for that data object type.
- Overrides:
getVector
in class BinaryDataFileReader
- Following copied from class:
edu.washington.NVisF.dataIO.DataReader
- Parameters:
predicate
- a string in the query language that identifies
the desired objectsdataField
- a string specifying the vector field to be returned- Returns:
- float[][] containing the array of vectors, or null if no
matches were found
- Throws:
java.text.ParseException
- if the predicate cannot be parsedNoConnectionException
- if there is no active connectionDataIOException
- if an unexpected error occurs- See Also:
DataReader.loadData(java.lang.String, java.lang.String[])