visad.data.dods
Class Valuator

java.lang.Object
  extended by visad.data.dods.Valuator
Direct Known Subclasses:
Float32Valuator, Float64Valuator, IntValuator

public abstract class Valuator
extends Object

Provides support for processing numeric values in a DODS dataset. Processing includes checking for non-equality with "missing" or "fill" values, unpacking into more capacious data types, and checking that the values lie within a valid range.

Instances are immutable.

Author:
Steven R. Emmerson

Field Summary
protected  ValueRanger ranger
           
protected  ValueUnpacker unpacker
           
protected  ValueVetter vetter
           
 
Constructor Summary
protected Valuator(dods.dap.AttributeTable table)
          Constructs from the attributes of a DODS variable.
 
Method Summary
protected static double decode(String name, dods.dap.AttributeTable table, int index)
          Decodes an attribute for a DODS variable.
abstract  SimpleSet getRepresentationalSet(RealType realType)
          Returns the set used to represent unpacked, numeric values associated with this instance in the range of a VisAD FlatField.
 double process(double value)
          Processes values.
 double[] process(double[] values)
          Processes values.
 float process(float value)
          Processes a value.
 float[] process(float[] values)
          Processes a value.
static Valuator valuator(dods.dap.AttributeTable table, int type)
          Returns an instance of this class corresponding to the attributes for a DODS variable.
static ValueRanger valueRanger(dods.dap.AttributeTable table)
          Returns an instance of a value ranger corresponding to the attributes of a DODS variable.
static ValueUnpacker valueUnpacker(dods.dap.AttributeTable table)
          Returns an instance of a value unpacker corresponding to the attributes of a DODS variable.
static ValueVetter valueVetter(dods.dap.AttributeTable table)
          Returns an instance of a value vetter corresponding to the attributes of a DODS variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vetter

protected final ValueVetter vetter

unpacker

protected final ValueUnpacker unpacker

ranger

protected final ValueRanger ranger
Constructor Detail

Valuator

protected Valuator(dods.dap.AttributeTable table)
            throws BadFormException,
                   VisADException,
                   RemoteException
Constructs from the attributes of a DODS variable.

Parameters:
table - The attribute table for a DODS variable.
Throws:
BadFormException - The attribute table is corrupt.
VisADException - VisAD failure.
RemoteException - Java RMI failure.
Method Detail

valuator

public static Valuator valuator(dods.dap.AttributeTable table,
                                int type)
                         throws BadFormException,
                                VisADException,
                                RemoteException
Returns an instance of this class corresponding to the attributes for a DODS variable.

Parameters:
table - The attribute table for a DODS variable.
type - The type of packed variable: Attribute.BYTE, Attribute.INT16, etc.
Throws:
BadFormException - The attribute table is corrupt.
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getRepresentationalSet

public abstract SimpleSet getRepresentationalSet(RealType realType)
                                          throws VisADException
Returns the set used to represent unpacked, numeric values associated with this instance in the range of a VisAD FlatField.

Returns:
realType The VisAD real-type for the set.
Throws:
VisADException - VisAD failure.

process

public float process(float value)
Processes a value.

Parameters:
value - The value to be processed.

process

public float[] process(float[] values)
Processes a value.

Parameters:
values - The values to be processed.

process

public double process(double value)
Processes values.

Parameters:
value - The value to be processed.

process

public double[] process(double[] values)
Processes values.

Parameters:
values - The values to be processed.

decode

protected static double decode(String name,
                               dods.dap.AttributeTable table,
                               int index)
                        throws BadFormException,
                               VisADException,
                               RemoteException
Decodes an attribute for a DODS variable.

Parameters:
name - The name of the attribute.
table - The attribute table of the DODS variable.
index - The index of the attribute element to be decoded.
Throws:
BadFormException - The DODS information is corrupt.
VisADException - VisAD failure.
RemoteException - Java RMI failure.

valueVetter

public static ValueVetter valueVetter(dods.dap.AttributeTable table)
                               throws BadFormException,
                                      VisADException,
                                      RemoteException
Returns an instance of a value vetter corresponding to the attributes of a DODS variable.

Parameters:
table - The DODS attribute table. May be null, in which case a trivial vetter is returned.
Returns:
A value vetter.
Throws:
BadFormException - The attribute table is corrupt.
VisADException - VisAD failure.
RemoteException - Java RMI failure.

valueUnpacker

public static ValueUnpacker valueUnpacker(dods.dap.AttributeTable table)
                                   throws BadFormException,
                                          VisADException,
                                          RemoteException
Returns an instance of a value unpacker corresponding to the attributes of a DODS variable.

Parameters:
table - A DODS attribute table. May be null, in which case a trivial unpacker is returned.
Returns:
A value unpacker.
Throws:
BadFormException - The attribute table is corrupt.
VisADException - VisAD failure.
RemoteException - Java RMI exception.

valueRanger

public static ValueRanger valueRanger(dods.dap.AttributeTable table)
                               throws BadFormException,
                                      VisADException,
                                      RemoteException
Returns an instance of a value ranger corresponding to the attributes of a DODS variable.

Parameters:
table - A DODS attribute table. May be null, in which case a trivial ranger is returned.
Returns:
A value ranger.
Throws:
BadFormException - The attribute table is corrupt.
VisADException - VisAD failure.
RemoteException - Java RMI exception.