visad.data.in
Class Selector

java.lang.Object
  extended by visad.data.in.DataInputFilter
      extended by visad.data.in.Selector
All Implemented Interfaces:
DataInputStream

public class Selector
extends DataInputFilter

Provides support for removing unwanted VisAD data objects from a stream of VisAD data objects.

Instances are modifiable.

Author:
Steven R. Emmerson

Constructor Summary
Selector(DataInputStream source)
          Constructs from an upstream data source.
 
Method Summary
 DataImpl readData()
          Returns the next VisAD data object in the input stream that satisfies the selection condition.
 void setCondition(Condition condition)
          Sets the condition for passing VisAD data objects.
 
Methods inherited from class visad.data.in.DataInputFilter
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Selector

public Selector(DataInputStream source)
         throws VisADException
Constructs from an upstream data source. The initial condition is set to the trivial condition Condition.TRIVIAL_CONDITION.

Parameters:
source - The upstream data source. May not be null.
Throws:
VisADException - The upstream data source is null.
Method Detail

setCondition

public void setCondition(Condition condition)
Sets the condition for passing VisAD data objects. A VisAD object that satisfies the condition will be passed on to the the downstream data sink. All others will be rejected.

Parameters:
condition - The pass/reject condition.

readData

public DataImpl readData()
                  throws VisADException,
                         RemoteException
Returns the next VisAD data object in the input stream that satisfies the selection condition. Returns null if there is no such object.

Returns:
A VisAD data object or null if there are no more such objects.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.