visad.data.dods
Class NumericAttributeAdapter

java.lang.Object
  extended by visad.data.dods.Adapter
      extended by visad.data.dods.AttributeAdapter
          extended by visad.data.dods.NumericAttributeAdapter
Direct Known Subclasses:
Float64AttributeAdapter, FloatAttributeAdapter

public abstract class NumericAttributeAdapter
extends AttributeAdapter

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

Instances are immutable.

Author:
Steven R. Emmerson

Constructor Summary
protected NumericAttributeAdapter(String name, dods.dap.Attribute attr)
          Constructs from a name and an appropriate attribute.
 
Method Summary
 DataImpl data(boolean copy)
          Returns the VisAD data object corresponding to this instance.
 String getAttributeName()
          Returns the name of the attribute used during construction of this instance.
 RealType getRealType()
          Returns the VisAD RealType of this instance.
protected abstract  Number number(String spec)
          Returns the numeric value corresponding to an appropriate string specification.
protected abstract  Set visadSet(List list)
          Returns the VisAD Set corresponding to the metadata of the attribute used in constructing this instance and a list of numeric values.
 
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

NumericAttributeAdapter

protected NumericAttributeAdapter(String name,
                                  dods.dap.Attribute attr)
                           throws VisADException
Constructs from a name and an appropriate attribute.

Parameters:
name - The name of the attribute.
attr - The attribute. Must have the appropriate type.
Throws:
VisADException - VisAD failure. Probably the attribute has an inappropriate type.
Method Detail

getRealType

public RealType getRealType()
Returns the VisAD RealType of this instance.

Returns:
The VisAD RealType of this instance.

getAttributeName

public String getAttributeName()
Returns the name of the attribute used during construction of this instance.

Returns:
The name of the attribute used during construction of this instance.

number

protected abstract Number number(String spec)
Returns the numeric value corresponding to an appropriate string specification.

Parameters:
spec - A string specification approrpriate to this instance.
Returns:
The numeric value corresponding to the string specification.

visadSet

protected abstract Set visadSet(List list)
                         throws VisADException
Returns the VisAD Set corresponding to the metadata of the attribute used in constructing this instance and a list of numeric values.

Parameters:
list - A list of numeric values. Each element must be of class Double.
Returns:
A VisAD set corresponding to the input.
Throws:
VisADException - VisAD failure.

data

public DataImpl data(boolean copy)
Returns the VisAD data object corresponding to this instance.

Specified by:
data in class AttributeAdapter
Parameters:
copy - If true, then a copy is returned.
Returns:
The VisAD data object corresponding to this instance.