Package ucar.visad
Class Quantity
java.lang.Object
ucar.visad.Quantity
- Direct Known Subclasses:
ScalarQuantity,TupleQuantity
Provides support for quantities (ex: temperature, wind). This class uses
the facade design pattern to provide a (hopefully) more convenient API to
the RealType, Real, RealTupleType, and RealTuple API-s. It also defines the
root of a hierarchy of classes that encapsulate quantity-specific scientific
knowledge.
- Version:
- $Revision: 1.13 $ $Date: 2005/05/13 18:34:03 $
- Author:
- Steven R. Emmerson
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ucar.visad.Quantity.DependenceModeIndicates that a secondary object will be the same object as the primary object.final ucar.visad.Quantity.DependenceModeIndicates that a secondary object will be a different object than the primary object.final ucar.visad.Quantity.DependenceModeIndicates that it is irrelevant whether or not a secondary object will be a different object than the primary object. -
Method Summary
Modifier and TypeMethodDescriptionReturns the naturalMathTypeof this quantity.final StringgetName()Returns the name of this quantity.final RealTupleTypeReturns the VisADRealTupleTypeof this quantity.booleanisCompatible(Data data) Indicates if a VisAD data object is compatible with this instance.booleanisCompatible(MathType type) Indicates if a VisAD MathType is compatible with this instance.final RealTuplenewRealTuple(double[] amounts, Unit[] units) Returns a single tuple of this quantity.final RealTuplenewRealTuple(double[] amounts, Unit[] units, CoordinateSystem coordSys) Returns a single tuple of this quantity.newRealTuple(double[] amounts, Unit[] units, ErrorEstimate[] errors, CoordinateSystem coordSys) Returns a single tuple of this quantity.newRealTuple(Real[] values, CoordinateSystem coordSys) Returns a single tuple of this quantity.newValue(double[] amounts, Unit[] units, ErrorEstimate[] errors, CoordinateSystem coordSys) Returns a single value of this quantity.final voidVets a VisAD data object for compatibility.final voidVets a VisAD MathType for compatibility.
-
Field Details
-
DEPENDENT
public final ucar.visad.Quantity.DependenceMode DEPENDENTIndicates that a secondary object will be the same object as the primary object. -
INDEPENDENT
public final ucar.visad.Quantity.DependenceMode INDEPENDENTIndicates that a secondary object will be a different object than the primary object. -
UNIMPORTANT
public final ucar.visad.Quantity.DependenceMode UNIMPORTANTIndicates that it is irrelevant whether or not a secondary object will be a different object than the primary object.
-
-
Method Details
-
getName
Returns the name of this quantity.- Returns:
- The name of this quantity.
-
getRealTupleType
Returns the VisADRealTupleTypeof this quantity.- Returns:
- The VisAD RealTupleType of this quantity.
-
getMathType
Returns the naturalMathTypeof this quantity. This method should be overridden in subclasses when appropriate.- Returns:
- The natural
MathTypeof this quantity. The class of the object is eitherRealTypeorRealTupleType.
-
newRealTuple
public final RealTuple newRealTuple(double[] amounts, Unit[] units) throws VisADException, RemoteException Returns a single tuple of this quantity. The coordinate system transformation specific to this instance will benull.- Parameters:
amounts- The numeric values.units- The units of the numeric values. May benull.- Returns:
- The single tuple corresponding to the input.
- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.- See Also:
-
newRealTuple
public final RealTuple newRealTuple(double[] amounts, Unit[] units, CoordinateSystem coordSys) throws VisADException, RemoteException Returns a single tuple of this quantity. The error estimate specific to this instance will benull.- Parameters:
amounts- The numeric values.units- The units of the numeric values. May benull.coordSys- The coordinate system transformation for this particular tuple. Must be compatible with the default coordinate system transformation. May benull.- Returns:
- The single tuple corresponding to the input.
- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.- See Also:
-
newRealTuple
public RealTuple newRealTuple(double[] amounts, Unit[] units, ErrorEstimate[] errors, CoordinateSystem coordSys) throws VisADException, RemoteException Returns a single tuple of this quantity.- Parameters:
amounts- The numeric values.units- The units of the numeric values. May benull.errors- The error estimates. May benull.coordSys- The coordinate system transformation for this particular tuple. Must be compatible with the default coordinate system transformation. May benull.- Returns:
- The single tuple corresponding to the input.
- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.- See Also:
-
newRealTuple
public RealTuple newRealTuple(Real[] values, CoordinateSystem coordSys) throws VisADException, RemoteException Returns a single tuple of this quantity.- Parameters:
values- The values.coordSys- The coordinate system transformation. May benull, in which case the default coordinate system transformation is used.- Returns:
- The single value corresponding to the input.
The class of the object is
RealTuple. - Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.
-
newValue
public DataImpl newValue(double[] amounts, Unit[] units, ErrorEstimate[] errors, CoordinateSystem coordSys) throws VisADException, RemoteException Returns a single value of this quantity. This method should be overridden when appropriate.- Parameters:
amounts- The numerical amounts.units- The units of the amounts. May benull-- in which case the defualt units are used; otherwise, elementiis the unit for the respective numerical amount (and may, itself, benull-- in which case the default unit is used).errors- The uncertainties of the numerical amounts. May benull, in which case the undertainties are zero; otherwise, elementiis the uncertainty for the respectve numerical amount (and may, itself, benull-- in which case the uncertainty is zero).coordSys- The coordinate system transformation. May benull, in which case the default coordinate system transformation is used.- Returns:
- The single value corresponding to the input.
Unless overridden, the class of the object is
RealTuple. - Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.
-
isCompatible
Indicates if a VisAD data object is compatible with this instance. A VisAD data object is compatible if its VisADMathTypeis compatible.- Parameters:
data- The VisAD data object to examine for compatibility.- Returns:
trueif and only if the MathType of the VisAD data object is compatible with this instance.- Throws:
VisADException- VisAD failure.RemoteException- Java RMI failure.- See Also:
-
isCompatible
Indicates if a VisAD MathType is compatible with this instance. A RealTupleType is compatible if itsRealTupleType.equalsExceptNameButUnits(visad.MathType)method returns true when given the return value ofgetRealTupleType()and if the coordinate system transformations are compatible. A SetType is compatible if its RealTupleType is compatible. A FunctionType is compatible if the MathType of its range is compatible. All other MathTypes are incompatible.- Parameters:
type- The VisAD MathType to examine for compatibility.- Returns:
trueif and only if the MathType is compatible with this instance.- Throws:
VisADException- VisAD failure.
-
vet
Vets a VisAD data object for compatibility.- Parameters:
data- The VisAD data object to examine for compatibility.- Throws:
TypeException- The VisAD data object is incompatible with this quantity.VisADException- VisAD failure.RemoteException- Java RMI failure.
-
vet
Vets a VisAD MathType for compatibility.- Parameters:
type- The VisAD MathType to examine for compatibility.- Throws:
VisADException- if a core VisAD failure occurs.
-