edu.washington.NVisF.plotter
Class PlotCommand

java.lang.Object
  |
  +--edu.washington.NVisF.plotter.PlotCommand

public class PlotCommand
extends java.lang.Object

A PlotCommand encapsulates a request to represent a certain set of data with a 3D representation suitable for viewing. Other classes collaborate with the PlotCommand, eventually inserting the ObjectGroup that contains the 3D representation. This class is intended to be the functional unit of a plotting request mediating access to the request and the resources needed to fulfill it. Currently the PlotCommand manages three components. First, it holds a DataReader that provides the physical data. Second, it holds a predicate that, when given to the DataReader, specifies which data objects should be used to construct the viewable object. Third, it holds a PlotStrategy that defines how to construct the 3D representation. The PlotStrategy is called to produce the 3D representation with this PlotCommand as an argument, which mediates access to the data by providing a subset of the functionality of DataReader. NullPointerExceptions will be thrown on an attempt to build a 3D object without having all the necessary resources previously defined, or when a null argument is passed to a contructor or setComponent method.


Constructor Summary
PlotCommand()
          Constructs an empty PlotCommand.
PlotCommand(DataReader dataReader, java.lang.String predicate)
          Constructs a PlotCommand referencing the specified DataReader and predicate, but with no defined PlotStrategy.
PlotCommand(DataReader dataReader, java.lang.String predicate, PlotManager plotManager)
          Constructs a PlotCommand referencing the specified DataReader and predicate.
PlotCommand(DataReader dataReader, java.lang.String predicate, PlotStrategy plotStrategy)
          Constructs a PlotCommand referencing the specified DataReader, predicate, and PlotStrategy.
 
Method Summary
 ObjectGroup buildObjectGroup()
          builds an ObjectGroup from the 3D objects created by the defined PlotStrategy and installs the result in this PlotCommand.
 int getCount()
          returns dataReader.getCount(predicate)
 DataReader getDataReader()
          returns a reference to this PlotCommand's DataReader.
 ObjectGroup getObjectGroup()
          returns the ObjectGroup for this PlotCommand.
 PlotStrategy getPlotStrategy()
          returns a reference to this PlotCommand's PlotStrategy.
 java.lang.String getPredicate()
          returns a reference to this PlotCommand's predicate.
 float[] getScalar(java.lang.String dataField)
          returns dataReader.getScalar(predicate,dataField)
 float[][] getVector(java.lang.String dataField)
          returns dataReader.getVector(predicate,dataField)
 java.lang.String parseObjectFromPredicate(java.lang.String predicate)
          extracts the object name from the given predicate.
 void setDataReader(DataReader dataReader)
          sets this PlotCommand's DataReader.
 void setPlotStrategy(PlotManager plotManager)
          sets this PlotCommand's PlotStrategy by extracting the object name from the predicate and using the name to retrieve a PlotStrategy from the supplied PlotManager.
 void setPlotStrategy(PlotStrategy plotStrategy)
          sets this PlotCommand's PlotStrategy.
 void setPredicate(java.lang.String predicate)
          sets this PlotCommand's predicate.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlotCommand

public PlotCommand()
Constructs an empty PlotCommand.

PlotCommand

public PlotCommand(DataReader dataReader,
                   java.lang.String predicate)
Constructs a PlotCommand referencing the specified DataReader and predicate, but with no defined PlotStrategy.
Throws:
NullPointerException - if any argument is null

PlotCommand

public PlotCommand(DataReader dataReader,
                   java.lang.String predicate,
                   PlotStrategy plotStrategy)
Constructs a PlotCommand referencing the specified DataReader, predicate, and PlotStrategy.
Throws:
NullPointerException - if any argument is null

PlotCommand

public PlotCommand(DataReader dataReader,
                   java.lang.String predicate,
                   PlotManager plotManager)
Constructs a PlotCommand referencing the specified DataReader and predicate. The predicate will be used to retrieve a PlotStrategy from the supplied PlotManager.
Throws:
NullPointerException - if any argument is null
Method Detail

getDataReader

public DataReader getDataReader()
returns a reference to this PlotCommand's DataReader.

setDataReader

public void setDataReader(DataReader dataReader)
sets this PlotCommand's DataReader.
Throws:
NullPointerException - if passed a null argument

getPredicate

public java.lang.String getPredicate()
returns a reference to this PlotCommand's predicate.

setPredicate

public void setPredicate(java.lang.String predicate)
sets this PlotCommand's predicate.
Throws:
NullPointerException - if passed a null argument

getPlotStrategy

public PlotStrategy getPlotStrategy()
returns a reference to this PlotCommand's PlotStrategy.

setPlotStrategy

public void setPlotStrategy(PlotStrategy plotStrategy)
sets this PlotCommand's PlotStrategy.
Throws:
NullPointerException - if passed a null argument

setPlotStrategy

public void setPlotStrategy(PlotManager plotManager)
sets this PlotCommand's PlotStrategy by extracting the object name from the predicate and using the name to retrieve a PlotStrategy from the supplied PlotManager.
Throws:
NullPointerException - if passed a null argument, or if no predicate has yet been defined, or if a null PlotStrategy is retrieved

parseObjectFromPredicate

public java.lang.String parseObjectFromPredicate(java.lang.String predicate)
extracts the object name from the given predicate. Currently the return value is simply the predicate itself.

buildObjectGroup

public ObjectGroup buildObjectGroup()
builds an ObjectGroup from the 3D objects created by the defined PlotStrategy and installs the result in this PlotCommand.
Returns:
ObjectGroup the newly created ObjectGroup
Throws:
NullPointerException - if some components have not been defined yet, or if an unexpected null occurs when assembling the 3D object

getObjectGroup

public ObjectGroup getObjectGroup()
returns the ObjectGroup for this PlotCommand. This may return null, especially if buildObjectGroup() has not yet been called.

getCount

public int getCount()
returns dataReader.getCount(predicate)
See Also:
DataReader

getScalar

public float[] getScalar(java.lang.String dataField)
returns dataReader.getScalar(predicate,dataField)
See Also:
DataReader

getVector

public float[][] getVector(java.lang.String dataField)
returns dataReader.getVector(predicate,dataField)
See Also:
DataReader