visad
Class MathType

java.lang.Object
  extended by visad.MathType
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FunctionType, ScalarType, SetType, TupleType

public abstract class MathType
extends Object
implements Serializable

MathType is the superclass for VisAD's hierarchy of mathematical types. It encompasses the mathematical concepts of scalars, tuples (i.e., n-dimensional vectors), functions, and certain forms of sets.

VisAD Data objects are finite approximations to math objects. Every Data object possesses a MathType, which characterizes the mathematical object that the data approximate. This MathType is not synonymous with the class of the Data object, even though the class names for a Data object and its corresponding MathType object (Set and SetType, e.g.) may be similar.

MathType objects are immutable; one implication is that the setDefaultSet method (in RealTupleType) can be invoked only prior to using the related getDefaultSet method.

See Also:
Serialized Form

Constructor Summary
MathType()
          this constructor assumes it is not creating an instrinsic MathType
 
Method Summary
static void addTimeAlias(String name)
          Adds a ScalarType name that guessMaps should map to Animation.
abstract  MathType binary(MathType type, int op, Vector names)
           
abstract  ShadowType buildShadowType(DataDisplayLink link, ShadowType parent)
           
abstract  MathType cloneDerivative(RealType d_partial)
           
abstract  boolean equals(Object type)
          ScalarTypes are equal if they have the same name; TupleTypes are equal if their components are equal; FunctionTypes are equal if their domains and ranges are equal
abstract  boolean equalsExceptName(MathType type)
          this is useful for determining compatibility of Data objects for binary mathematical operations; any RealTypes are equal; any TextTypes are equal; TupleTypes are equal if their components are equal; FunctionTypes are equal if their domains and ranges are equal
abstract  boolean equalsExceptNameButUnits(MathType type)
           
static boolean findScalarType(MathType mt, ScalarType st)
          return true if st occurs in mt
 ScalarMap[] guessMaps(boolean threeD)
          Guesses at a set of "default" mappings for this MathType.
static void main(String[] args)
          run 'java visad.MathType' to test MathType.prettyString() and MathType.guessMaps()
abstract  Data missingData()
          returns a missing Data object for any MathType
 String prettyString()
          return a String that indents complex MathTypes for human readability
abstract  String prettyString(int indent)
           
static MathType stringToType(String s)
          create a MathType from its string representation; essentially the inverse of the prettyString method
 String toString()
           
abstract  MathType unary(int op, Vector names)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MathType

public MathType()
this constructor assumes it is not creating an instrinsic MathType

Method Detail

equals

public abstract boolean equals(Object type)
ScalarTypes are equal if they have the same name; TupleTypes are equal if their components are equal; FunctionTypes are equal if their domains and ranges are equal

Overrides:
equals in class Object

equalsExceptName

public abstract boolean equalsExceptName(MathType type)
this is useful for determining compatibility of Data objects for binary mathematical operations; any RealTypes are equal; any TextTypes are equal; TupleTypes are equal if their components are equal; FunctionTypes are equal if their domains and ranges are equal


equalsExceptNameButUnits

public abstract boolean equalsExceptNameButUnits(MathType type)
                                          throws VisADException
Throws:
VisADException

cloneDerivative

public abstract MathType cloneDerivative(RealType d_partial)
                                  throws VisADException
Throws:
VisADException

binary

public abstract MathType binary(MathType type,
                                int op,
                                Vector names)
                         throws VisADException
Throws:
VisADException

unary

public abstract MathType unary(int op,
                               Vector names)
                        throws VisADException
Throws:
VisADException

missingData

public abstract Data missingData()
                          throws VisADException,
                                 RemoteException
returns a missing Data object for any MathType

Throws:
VisADException
RemoteException

buildShadowType

public abstract ShadowType buildShadowType(DataDisplayLink link,
                                           ShadowType parent)
                                    throws VisADException,
                                           RemoteException
Throws:
VisADException
RemoteException

toString

public String toString()
Overrides:
toString in class Object

prettyString

public String prettyString()
return a String that indents complex MathTypes for human readability


prettyString

public abstract String prettyString(int indent)

stringToType

public static MathType stringToType(String s)
                             throws VisADException
create a MathType from its string representation; essentially the inverse of the prettyString method

Throws:
VisADException

addTimeAlias

public static void addTimeAlias(String name)
Adds a ScalarType name that guessMaps should map to Animation.


guessMaps

public ScalarMap[] guessMaps(boolean threeD)
Guesses at a set of "default" mappings for this MathType. Intuitively, first we look for a FunctionType with domain dimension 3, then a nested group of FunctionTypes with 'cumulative' domain dimension 3. Next we look for a FunctionType or nested group of FunctionTypes with domain dimension 2. Then, we look for a FunctionType with domain dimension 1. Nested groups of FunctionTypes may be nested with TupleTypes, which is indicated by some of the MathType templates. Lastly, if no matching FunctionTypes are found, then we look for 3-D, 2-D, or 1-D SetTypes.


findScalarType

public static boolean findScalarType(MathType mt,
                                     ScalarType st)
                              throws VisADException
return true if st occurs in mt

Throws:
VisADException

main

public static void main(String[] args)
                 throws VisADException,
                        RemoteException
run 'java visad.MathType' to test MathType.prettyString() and MathType.guessMaps()

Throws:
VisADException
RemoteException