visad
Class RealType

java.lang.Object
  extended by visad.MathType
      extended by visad.ScalarType
          extended by visad.RealType
All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
DisplayRealType, Quantity

public class RealType
extends ScalarType

RealType is the VisAD scalar data type for real number variables.

See Also:
Serialized Form

Field Summary
static RealType Altitude
           
static RealType Declination
          astronomical coordinates
static RealType Generic
          generic RealType
static int INTERVAL
          The interval attribute.
static RealType Latitude
          Spherical spatial coordinate for Latitude
static RealType Longitude
          Spherical spatial coordinate for Longitude
static RealType Radius
           
static RealType RightAscension
           
static RealType Time
          Timestamp coordinate
static RealType TimeInterval
          Temporal-interval coordinate
static RealType XAxis
          Cartesian spatial coordinate - X axis
static RealType YAxis
          Cartesian spatial coordinate - Y axis
static RealType ZAxis
          Cartesian spatial coordinate - Z axis
 
Constructor Summary
  RealType(String name)
          Deprecated. Use getRealType(String)
  RealType(String name, int attrMask)
          Deprecated. Use getRealType(String, int)
  RealType(String name, Unit u)
          Deprecated. Use getRealType(String, Unit)
protected RealType(String name, Unit u, boolean b)
          trusted constructor for initializers
protected RealType(String name, Unit u, int attrMask, boolean b)
          trusted constructor for initializers
  RealType(String name, Unit u, Set set)
          Deprecated. Use getRealType(String, Unit, Set)
  RealType(String name, Unit u, Set set, int attrMask)
          Deprecated. Use getRealType(String, Unit, Set, int)
protected RealType(String name, Unit u, Set s, int attrMask, boolean b)
          trusted constructor for initializers
 
Method Summary
 MathType binary(MathType type, int op, Vector names)
           
 ShadowType buildShadowType(DataDisplayLink link, ShadowType parent)
           
 MathType cloneDerivative(RealType d_partial)
           
 boolean equals(Object type)
          Check the equality of type with this RealType; two RealType-s are equal if they have the same name, convertible DefaultUnit-s, same DefaultSet and attrMask; a RealType copied from a remote Java virtual machine may have the same name but different values for other fields
 boolean equalsExceptName(MathType type)
          any two RealType-s are equal except Name
 boolean equalsExceptNameButUnits(MathType type)
          Check to see if type has convertible units with this RealType.
 int getAttributeMask()
          Gets the attribute mask of this RealType.
 Set getDefaultSet()
          get default Set
 Unit getDefaultUnit()
          get default Unit
static RealType getRealType(String name)
          Returns a RealType corresponding to a name.
static RealType getRealType(String name, int attrMask)
          Returns a RealType corresponding to a name and attribute mask.
static RealType getRealType(String name, Unit u)
          Returns a RealType corresponding to a name and unit.
static RealType getRealType(String name, Unit u, int attrMask)
          Returns a RealType corresponding to a name, unit, and attribute mask.
static RealType getRealType(String name, Unit u, Set set)
          Returns a RealType corresponding to a name, unit, and representational set.
static RealType getRealType(String name, Unit u, Set set, int attrMask)
          Returns a RealType corresponding to a name, unit, representational set, and attribute mask.
static RealType getRealTypeByName(String name)
          return any RealType constructed in this JVM with name, or null
 boolean isInterval()
          Indicates whether or not this RealType refers to an interval (e.g.
static void main(String[] args)
           
 Data missingData()
          returns a missing Data object for any MathType
 String prettyString(int indent)
           
 void setDefaultSet(Set sampling)
          set the default Set; this is a violation of MathType immutability to allow a a RealType to be an argument (directly or through a SetType) to the constructor of its default Set; this method throws an Exception if getDefaultSet has previously been invoked
 MathType unary(int op, Vector names)
           
 
Methods inherited from class visad.ScalarType
alias, compareTo, getAlias, getName, getNameWithBlanks, getOriginalName, getScalarTypeByName, hashCode, readResolve, validateName
 
Methods inherited from class visad.MathType
addTimeAlias, findScalarType, guessMaps, prettyString, stringToType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INTERVAL

public static final int INTERVAL
The interval attribute. This attribute should be used during construction of a RealType if the RealType refers to an interval (e.g. length difference, delta temperature). In general, RealType-s that are temporal in nature should have this attribute because the "time" variable in most formulae actually refer to time differences (e.g. "time since the beginning of the experiment"). One obvious exception to this lies with cosmology, where "time" is absolute rather than an interval.

See Also:
Constant Field Values

XAxis

public static final RealType XAxis
Cartesian spatial coordinate - X axis


YAxis

public static final RealType YAxis
Cartesian spatial coordinate - Y axis


ZAxis

public static final RealType ZAxis
Cartesian spatial coordinate - Z axis


Latitude

public static final RealType Latitude
Spherical spatial coordinate for Latitude


Longitude

public static final RealType Longitude
Spherical spatial coordinate for Longitude


Altitude

public static final RealType Altitude

Radius

public static final RealType Radius

TimeInterval

public static final RealType TimeInterval
Temporal-interval coordinate


Time

public static final RealType Time
Timestamp coordinate


Declination

public static final RealType Declination
astronomical coordinates


RightAscension

public static final RealType RightAscension

Generic

public static final RealType Generic
generic RealType

Constructor Detail

RealType

public RealType(String name)
         throws VisADException
Deprecated. Use getRealType(String)

Constructs from a name (two RealTypes are equal if their names are equal). Assumes null for the default Unit and default Set and that the RealType does not refer to an interval.

Parameters:
name - The name for the RealType.
Throws:
VisADException - Couldn't create necessary VisAD object.

RealType

public RealType(String name,
                int attrMask)
         throws VisADException
Deprecated. Use getRealType(String, int)

Constructs from a name (two RealTypes are equal if their names are equal) and whether or not the RealType refers to an interval (e.g. length difference, delta temperature). Assumes null for the default Unit and default Set.

Parameters:
name - The name for the RealType.
attrMask - The attribute mask. 0 or INTERVAL.
Throws:
VisADException - Couldn't create necessary VisAD object.

RealType

public RealType(String name,
                Unit u,
                Set set)
         throws VisADException
Deprecated. Use getRealType(String, Unit, Set)

Constructs from a name (two RealTypes are equal if their names are equal) a default Unit, and a default Set. Assumes that the RealType does not refer to an interval.

Parameters:
name - The name for the RealType.
u - The default unit for the RealType. May be null.
set - The default sampling set for the RealType. Used when this type is a FunctionType domain. May be null.
Throws:
VisADException - Couldn't create necessary VisAD object.

RealType

public RealType(String name,
                Unit u)
         throws VisADException
Deprecated. Use getRealType(String, Unit)

Constructs from a name (two RealTypes are equal if their names are equal) and a default Unit. Assumes the default Set, and that the RealType does not refer to an interval.

Parameters:
name - The name for the RealType.
u - The default unit for the RealType. May be null.
Throws:
VisADException - Couldn't create necessary VisAD object.

RealType

public RealType(String name,
                Unit u,
                Set set,
                int attrMask)
         throws VisADException
Deprecated. Use getRealType(String, Unit, Set, int)

Constructs from a name (two RealTypes are equal if their names are equal) a default Unit, a default Set, and whether or not the RealType refers to an interval (e.g. length difference, delta temperature). This is the most general, public constructor.

Parameters:
name - The name for the RealType.
u - The default unit for the RealType. May be null. If non-null and the RealType refers to an interval, then the default unit will actually be u.getAbsoluteUnit().
set - The default sampling set for the RealType. Used when this type is a FunctionType domain. May be null.
attrMask - The attribute mask. 0 or INTERVAL.
Throws:
VisADException - Couldn't create necessary VisAD object.

RealType

protected RealType(String name,
                   Unit u,
                   boolean b)
trusted constructor for initializers


RealType

protected RealType(String name,
                   Unit u,
                   int attrMask,
                   boolean b)
trusted constructor for initializers


RealType

protected RealType(String name,
                   Unit u,
                   Set s,
                   int attrMask,
                   boolean b)
            throws SetException
trusted constructor for initializers

Throws:
SetException
Method Detail

getAttributeMask

public final int getAttributeMask()
Gets the attribute mask of this RealType.

Returns:
The attribute mask of this RealType.

isInterval

public final boolean isInterval()
Indicates whether or not this RealType refers to an interval (e.g. length difference, delta temperature).

Returns:
Whether or not this RealType refers to an interval.

getDefaultUnit

public Unit getDefaultUnit()
get default Unit


getDefaultSet

public Set getDefaultSet()
get default Set


setDefaultSet

public void setDefaultSet(Set sampling)
                   throws VisADException
set the default Set; this is a violation of MathType immutability to allow a a RealType to be an argument (directly or through a SetType) to the constructor of its default Set; this method throws an Exception if getDefaultSet has previously been invoked

Throws:
VisADException

equals

public boolean equals(Object type)
Check the equality of type with this RealType; two RealType-s are equal if they have the same name, convertible DefaultUnit-s, same DefaultSet and attrMask; a RealType copied from a remote Java virtual machine may have the same name but different values for other fields

Overrides:
equals in class ScalarType
Parameters:
type - object in question
Returns:
true if type is a RealType and the conditions above are met

equalsExceptName

public boolean equalsExceptName(MathType type)
any two RealType-s are equal except Name

Specified by:
equalsExceptName in class MathType

equalsExceptNameButUnits

public boolean equalsExceptNameButUnits(MathType type)
Check to see if type has convertible units with this RealType.

Specified by:
equalsExceptNameButUnits in class MathType
Parameters:
type - MathType to check
Returns:
true if type is a RealType or a RealTupleType of dimension 1 AND the units are convertible with this RealType's default Unit.

cloneDerivative

public MathType cloneDerivative(RealType d_partial)
                         throws VisADException
Specified by:
cloneDerivative in class MathType
Throws:
VisADException

binary

public MathType binary(MathType type,
                       int op,
                       Vector names)
                throws VisADException
Specified by:
binary in class MathType
Throws:
VisADException

unary

public MathType unary(int op,
                      Vector names)
               throws VisADException
Specified by:
unary in class MathType
Throws:
VisADException

missingData

public Data missingData()
                 throws VisADException
Description copied from class: MathType
returns a missing Data object for any MathType

Specified by:
missingData in class MathType
Throws:
VisADException

getRealType

public static final RealType getRealType(String name)
Returns a RealType corresponding to a name. If a RealType with the given name doesn't exist, then it's created (with default unit, representational set, and attribute mask) and returned; otherwise, the previously existing RealType is returned if it is compatible with the input arguments (the unit, representational set, and attribute mask are ignored in the comparison); otherwise null is returned.

Parameters:
name - The name for the RealType.
Returns:
A RealType corresponding to the input arguments or null.
Throws:
NullPointerException - if the name is null.

getRealType

public static final RealType getRealType(String name,
                                         Unit u)
Returns a RealType corresponding to a name and unit. If a RealType with the given name doesn't exist, then it's created (with default representational set and attribute mask) and returned; otherwise, the previously existing RealType is returned if it is compatible with the input arguments (the representational set and attribute mask are ignored in the comparison); otherwise null is returned. Note that the unit of the returned RealType will be convertible with the unit argument but might not equal it.

Parameters:
name - The name for the RealType.
u - The unit for the RealType.
Returns:
A RealType corresponding to the input arguments or null.
Throws:
NullPointerException - if the name is null.

getRealType

public static RealType getRealType(String name,
                                   int attrMask)
Returns a RealType corresponding to a name and attribute mask. If a RealType with the given name doesn't exist, then it's created (with default unit and representational set) and returned; otherwise, the previously existing RealType is returned if it is compatible with the input arguments (the unit and representational set are ignored in the comparison); otherwise null is returned. Note that the unit of the returned RealType will be convertible with the unit argument but might not equal it.

Parameters:
name - The name for the RealType.
attrMask - The attribute mask for the RealType.
Returns:
A RealType corresponding to the input arguments or null.
Throws:
NullPointerException - if the name is null.

getRealType

public static RealType getRealType(String name,
                                   Unit u,
                                   Set set)
Returns a RealType corresponding to a name, unit, and representational set. If a RealType with the given name doesn't exist, then it's created (with a default attribute mask) and returned; otherwise, the previously existing RealType is returned if it is compatible with the input arguments (the attribute mask is ignored in the comparison); otherwise null is returned. Note that the unit of the returned RealType will be convertible with the unit argument but might not equal it.

Parameters:
name - The name for the RealType.
u - The unit for the RealType.
set - The representational set for the RealType.
Returns:
A RealType corresponding to the input arguments or null.
Throws:
NullPointerException - if the name is null.

getRealType

public static final RealType getRealType(String name,
                                         Unit u,
                                         int attrMask)
Returns a RealType corresponding to a name, unit, and attribute mask. If a RealType with the given name doesn't exist, then it's created (with a default representational set) and returned; otherwise, the previously existing RealType is returned if it is compatible with the input arguments (the representational set is ignored in the comparison); otherwise null is returned. Note that the unit of the returned RealType will be convertible with the unit argument but might not equal it.

Parameters:
name - The name for the RealType.
u - The unit for the RealType.
attrMask - The attribute mask for the RealType.
Returns:
A RealType corresponding to the input arguments or null.
Throws:
NullPointerException - if the name is null.

getRealType

public static final RealType getRealType(String name,
                                         Unit u,
                                         Set set,
                                         int attrMask)
Returns a RealType corresponding to a name, unit, representational set, and attribute mask. If a RealType with the given name doesn't exist, then it's created and returned; otherwise, the previously existing RealType is returned if it is compatible with the input arguments; otherwise null is returned. Note that the unit of the returned RealType will be convertible with the unit argument but might not equal it.

Parameters:
name - The name for the RealType.
u - The unit for the RealType.
set - The representational set for the RealType.
attrMask - The attribute mask for the RealType.
Returns:
A RealType corresponding to the input arguments or null.
Throws:
NullPointerException - if the name is null.

getRealTypeByName

public static RealType getRealTypeByName(String name)
return any RealType constructed in this JVM with name, or null


buildShadowType

public ShadowType buildShadowType(DataDisplayLink link,
                                  ShadowType parent)
                           throws VisADException,
                                  RemoteException
Specified by:
buildShadowType in class MathType
Throws:
VisADException
RemoteException

prettyString

public String prettyString(int indent)
Specified by:
prettyString in class MathType

main

public static void main(String[] args)
                 throws VisADException
Throws:
VisADException