visad.data.dods
Class VariableAdapter

java.lang.Object
  extended by visad.data.dods.Adapter
      extended by visad.data.dods.VariableAdapter
Direct Known Subclasses:
ArrayVariableAdapter, BooleanVariableAdapter, ByteVariableAdapter, Float32VariableAdapter, Float64VariableAdapter, GridVariableAdapter, GridVariableMapAdapter, Int16VariableAdapter, Int32VariableAdapter, ListVariableAdapter, SequenceVariableAdapter, StringVariableAdapter, StructureVariableAdapter, UInt16VariableAdapter, UInt32VariableAdapter

public abstract class VariableAdapter
extends Adapter

Provides support for adapting DODS objects to the VisAD data-import context.

Instances are immutable.

Author:
Steven R. Emmerson

Constructor Summary
VariableAdapter()
           
 
Method Summary
 DataImpl data(dods.dap.BaseType baseType, boolean copy)
          Returns the VisAD DataImpl corresponding to the data of a DODS variable and the metaData of the DODS variable used during construction of this instance.
 DataImpl data(dods.dap.DArray var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DBoolean var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DByte var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DFloat32 var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DFloat64 var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DGrid var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DInt16 var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DInt32 var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DList var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DSequence var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DString var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DStructure var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DUInt16 var, boolean copy)
          Throws a VisADException.
 DataImpl data(dods.dap.DUInt32 var, boolean copy)
          Throws a VisADException.
abstract  MathType getMathType()
          Returns the VisAD MathType of this instance.
 SimpleSet[] getRepresentationalSets(boolean copy)
          Returns the default VisAD Sets that will be used to represent this instances data values in the range of a VisAD FlatField.
protected static MathType mathType(VariableAdapter[] adapters)
          Returns the VisAD MathType corresponding to an array of adapters of DODS variables.
 
Methods inherited from class visad.data.dods.Adapter
attributeTable, attributeTable, getCacheStrategy, isFlat, mathType, realType, realType, realType, realType, scalarName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableAdapter

public VariableAdapter()
Method Detail

getMathType

public abstract MathType getMathType()
Returns the VisAD MathType of this instance.

Returns:
The MathType of this instance.

data

public DataImpl data(dods.dap.BaseType baseType,
                     boolean copy)
              throws BadFormException,
                     VisADException,
                     RemoteException
Returns the VisAD DataImpl corresponding to the data of a DODS variable and the metaData of the DODS variable used during construction of this instance.

Parameters:
baseType - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction. The class of the object will depend upon the DODS variable used during construction.
Throws:
BadFormException - The DODS variable is corrupt.
VisADException - VisAD failure. Possibly the variable wasn't compatible with the variable used to construct this instance.
RemoteException - Java RMI failure.

data

public DataImpl data(dods.dap.DString var,
                     boolean copy)
              throws VisADException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.

data

public DataImpl data(dods.dap.DBoolean var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DByte var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DUInt16 var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DInt16 var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DUInt32 var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DInt32 var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DFloat32 var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DFloat64 var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DStructure var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DList var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DArray var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DGrid var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

data

public DataImpl data(dods.dap.DSequence var,
                     boolean copy)
              throws VisADException,
                     RemoteException
Throws a VisADException. Override in subclasses where appropriate.

Parameters:
var - The DODS variable to have the corresponding VisAD data object returned. The variable must be compatible with the variable used to construct this instance.
copy - If true, then data values are copied.
Returns:
A VisAD data object corresponding to the data of the DODS variable and the metadata of the DODS variable used during construction.
Throws:
VisADException - Don't know how to create a VisAD data object from the given DODS variable.
RemoteException

getRepresentationalSets

public SimpleSet[] getRepresentationalSets(boolean copy)
Returns the default VisAD Sets that will be used to represent this instances data values in the range of a VisAD FlatField. Override this method in subclasses where appropriate.

Parameters:
copy - If true, then the array is cloned.
Returns:
The default VisAD Sets used to represent the data values in the range of a FlatField. Will never be null -- though an individual elements might be (e.g. for TextType objects).

mathType

protected static MathType mathType(VariableAdapter[] adapters)
                            throws VisADException,
                                   RemoteException
Returns the VisAD MathType corresponding to an array of adapters of DODS variables. If the array has zero length, then the returned MathType will be null; otherwise, if the array has a single element, then a MathType corresponding to the element will be returned; otherwise, the returned MathType will be a RealTupleType or a TupleType as appropriate.

Parameters:
adapters - An array of adapters of DODS variables. May not be null, nor may any element be null. May have zero length.
Returns:
A VisAD MathType corresponding to the array of adapters.
Throws:
VisADException
RemoteException