visad
Class ScalarType
- java.lang.Object
-
- visad.MathType
-
- visad.ScalarType
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable
public abstract class ScalarType extends MathType implements java.lang.Comparable
ScalarType is the superclass of the VisAD hierarchy of scalar data types.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ScalarType(java.lang.String name)Create aScalarTypewith the specified name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidalias(java.lang.String alias)Change the primary name for thisScalarType.intcompareTo(java.lang.Object obj)Compares this object with another of the same type.booleanequals(java.lang.Object obj)Indicates if this ScalarType is the same as another object.java.lang.StringgetAlias()Returns the alias of this instance ornullif this instance has no alias.java.lang.StringgetName()Returns thisScalarType's name.java.lang.StringgetNameWithBlanks()java.lang.StringgetOriginalName()Returns the original name of this instance.static ScalarTypegetScalarTypeByName(java.lang.String name)Get theScalarTypewhich has the specified name.inthashCode()Obtains the hash code for this object.static voidvalidateName(java.lang.String name, java.lang.String type)Throw aTypeExceptionif the name is invalid.-
Methods inherited from class visad.MathType
addTimeAlias, binary, buildShadowType, cloneDerivative, equalsExceptName, equalsExceptNameButUnits, findScalarType, guessMaps, main, missingData, prettyString, prettyString, stringToType, toString, unary
-
-
-
-
Constructor Detail
-
ScalarType
public ScalarType(java.lang.String name) throws VisADExceptionCreate aScalarTypewith the specified name.- Parameters:
name- The name of thisScalarType- Throws:
VisADException- If the name is not valid.
-
-
Method Detail
-
compareTo
public int compareTo(java.lang.Object obj)
Compares this object with another of the same type. The comparison is on the names.- Specified by:
compareToin interfacejava.lang.Comparable- Parameters:
obj- The other object of the same type.- Returns:
- A value less than zero, zero, or greater than zero depending on whether this object is considered less than, equal to, or greater than the other object, respectively.
- Throws:
java.lang.ClassCastException- if the object is not aScalarType.
-
equals
public boolean equals(java.lang.Object obj)
Indicates if this ScalarType is the same as another object.
-
hashCode
public int hashCode()
Obtains the hash code for this object. IfscalarType1.equals(scalarType2), thenscalarType1.hashCode() == scalarType2.hashCode().- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code for this object.
-
alias
public void alias(java.lang.String alias) throws TypeExceptionChange the primary name for thisScalarType. The original name can still be used.If multiple aliases are created, the last one is dominant.
This is handy for translating standard VisAD
RealTypenames to a language other than English.- Parameters:
alias- The new name.- Throws:
TypeException- If the new name is not valid.
-
getName
public final java.lang.String getName()
Returns thisScalarType's name. If an alias exists, then it it is returned; otherwise, the name given to the constructor is used.- Returns:
- The name of this
ScalarType.
-
getOriginalName
public final java.lang.String getOriginalName()
Returns the original name of this instance. This method ignores any alias and returns the name given to the constructor.- Returns:
- The original name.
-
getAlias
public final java.lang.String getAlias()
Returns the alias of this instance ornullif this instance has no alias. This method returns the alias set by the most recentalias(String)invocation.- Returns:
- The alias or
null.
-
getNameWithBlanks
public java.lang.String getNameWithBlanks()
-
getScalarTypeByName
public static ScalarType getScalarTypeByName(java.lang.String name)
Get theScalarTypewhich has the specified name.- Parameters:
name- Name ofScalarType.- Returns:
- Either the
ScalarTypeif found, ornull.
-
validateName
public static void validateName(java.lang.String name, java.lang.String type) throws TypeExceptionThrow aTypeExceptionif the name is invalid.- Parameters:
name- Name to check.type- Type used in exception message.- Throws:
TypeException- If there is a problem with the name.
-
-
DMelt 3.0 © DataMelt by jWork.ORG