visad.data.netcdf
Class Quantity
- java.lang.Object
-
- visad.MathType
-
- visad.ScalarType
-
- visad.RealType
-
- visad.data.netcdf.Quantity
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable
public class Quantity extends RealType
The following class represents a quantity -- usually a physical one such as energy, viscosity, or velocity (although an artificial one such as "money" should be possible). It extends RealType by carrying around a preferred unit as a string because a Unit is useless for doing that. A Quantity is immutable.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class visad.RealType
Altitude, Declination, Generic, INTERVAL, Latitude, Longitude, Radius, RightAscension, Time, TimeInterval, XAxis, YAxis, ZAxis
-
-
Constructor Summary
Constructors Constructor and Description Quantity(java.lang.String name, java.lang.String unitSpec)Constructs from a name and a unit specification.Quantity(java.lang.String name, java.lang.String unitSpec, SimpleSet set)Constructs from a name, a unit specification, and a sample set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringgetDefaultUnitString()Return the default unit of this quantity as a string.static QuantitygetQuantity(java.lang.String name, java.lang.String unitSpec)create a new Quantity, or return it if it already existsstatic QuantitygetQuantity(java.lang.String name, java.lang.String unitSpec, SimpleSet set)create a new Quantity, or return it if it already existsstatic QuantitygetQuantityByName(java.lang.String name)return any Quantity constructed in this JVM with name, or null-
Methods inherited from class visad.RealType
binary, buildShadowType, cloneDerivative, equals, equalsExceptName, equalsExceptNameButUnits, getAttributeMask, getDefaultSet, getDefaultUnit, getRealType, getRealType, getRealType, getRealType, getRealType, getRealType, getRealTypeByName, isInterval, main, missingData, prettyString, setDefaultSet, unary
-
Methods inherited from class visad.ScalarType
alias, compareTo, getAlias, getName, getNameWithBlanks, getOriginalName, getScalarTypeByName, hashCode, validateName
-
Methods inherited from class visad.MathType
addTimeAlias, findScalarType, guessMaps, prettyString, stringToType, toString
-
-
-
-
Constructor Detail
-
Quantity
public Quantity(java.lang.String name, java.lang.String unitSpec, SimpleSet set) throws VisADException, ParseExceptionConstructs from a name, a unit specification, and a sample set.- Parameters:
name- The name of the quantity (e.g. "length").unitSpec- The preferred unit for the quantity (e.g. "feet").set- The default sample set for the quantity. May benull.- Throws:
ParseException- Couldn't decode unit specification.VisADException- ScalarType of same name already exists.
-
Quantity
public Quantity(java.lang.String name, java.lang.String unitSpec) throws VisADException, ParseExceptionConstructs from a name and a unit specification.- Parameters:
name- The name of the quantity (e.g. "length").unitSpec- The preferred unit for the quantity (e.g. "feet").- Throws:
VisADException- Can't create necessary VisAD object.ParseException- Couldn't decode unit specification.
-
-
Method Detail
-
getDefaultUnitString
public java.lang.String getDefaultUnitString()
Return the default unit of this quantity as a string.- Returns:
- The default unit of this quantity or
nullif no such unit.
-
getQuantity
public static Quantity getQuantity(java.lang.String name, java.lang.String unitSpec, SimpleSet set) throws ParseException
create a new Quantity, or return it if it already exists- Throws:
ParseException
-
getQuantity
public static Quantity getQuantity(java.lang.String name, java.lang.String unitSpec) throws ParseException
create a new Quantity, or return it if it already exists- Throws:
ParseException
-
getQuantityByName
public static Quantity getQuantityByName(java.lang.String name)
return any Quantity constructed in this JVM with name, or null
-
-
DMelt 3.0 © DataMelt by jWork.ORG