Package ucar.units
Class BaseQuantity
- java.lang.Object
-
- ucar.units.BaseQuantity
-
- All Implemented Interfaces:
Serializable,Comparable<BaseQuantity>,Base
- Direct Known Subclasses:
RegularBaseQuantity,SupplementaryBaseQuantity,UnknownBaseQuantity
public abstract class BaseQuantity extends Object implements Base, Comparable<BaseQuantity>, Serializable
Provides support for abstract base quantities (ex: length, time).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static RegularBaseQuantityAMOUNT_OF_SUBSTANCEThe base quantity of amount of substance.static RegularBaseQuantityELECTRIC_CURRENTThe base quantity of electric current.static RegularBaseQuantityLENGTHThe base quantity of length.static RegularBaseQuantityLUMINOUS_INTENSITYThe base quantity of luminous intensity.static RegularBaseQuantityMASSThe base quantity of mass.static SupplementaryBaseQuantityPLANE_ANGLEThe base quantity of plane angle.static SupplementaryBaseQuantitySOLID_ANGLEThe base quantity of solid angle.static RegularBaseQuantityTHERMODYNAMIC_TEMPERATUREThe base quantity of themodynamic temperature.static RegularBaseQuantityTIMEThe base quantity of time.static UnknownBaseQuantityUNKNOWNThe unknown base quantity.
-
Constructor Summary
Constructors Modifier Constructor Description BaseQuantity(String name, String symbol)Constructs from a name and a symbol.protectedBaseQuantity(String name, String symbol, boolean trusted)Constructs from a name and a symbol.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(BaseQuantity that)Compares this base quantity to another base quantity.booleanequals(Object object)Indicates if this base quantity is semantically identical to an object.StringgetID()Returns the identifier for the base quantity.StringgetName()Returns the name of the base quantity.StringgetSymbol()Returns the symbol of the base quantity.inthashCode()Returns the hash code of this instance.abstract booleanisDimensionless()Indicates if this base quantity is dimensionless.StringtoString()Returns the string representation of the base quantity.
-
-
-
Field Detail
-
AMOUNT_OF_SUBSTANCE
public static final RegularBaseQuantity AMOUNT_OF_SUBSTANCE
The base quantity of amount of substance.
-
ELECTRIC_CURRENT
public static final RegularBaseQuantity ELECTRIC_CURRENT
The base quantity of electric current.
-
LENGTH
public static final RegularBaseQuantity LENGTH
The base quantity of length.
-
LUMINOUS_INTENSITY
public static final RegularBaseQuantity LUMINOUS_INTENSITY
The base quantity of luminous intensity.
-
MASS
public static final RegularBaseQuantity MASS
The base quantity of mass.
-
PLANE_ANGLE
public static final SupplementaryBaseQuantity PLANE_ANGLE
The base quantity of plane angle.
-
SOLID_ANGLE
public static final SupplementaryBaseQuantity SOLID_ANGLE
The base quantity of solid angle.
-
THERMODYNAMIC_TEMPERATURE
public static final RegularBaseQuantity THERMODYNAMIC_TEMPERATURE
The base quantity of themodynamic temperature.
-
TIME
public static final RegularBaseQuantity TIME
The base quantity of time.
-
UNKNOWN
public static final UnknownBaseQuantity UNKNOWN
The unknown base quantity.
-
-
Constructor Detail
-
BaseQuantity
public BaseQuantity(String name, String symbol) throws NameException
Constructs from a name and a symbol.- Parameters:
name- Name of the base quantity. Shall be neithernullnor empty.symbol- Symbol for the base quantity. May benullbut shall not be empty.- Throws:
NameException-nameisnullor empty.
-
BaseQuantity
protected BaseQuantity(String name, String symbol, boolean trusted)
Constructs from a name and a symbol. This is the trusted form of the the constructor for use by subclasses only.- Parameters:
name- Name of the base quantity. Shall be neithernullnor empty.symbol- Symbol for the base quantity. May benullbut shall not be empty.
-
-
Method Detail
-
getName
public String getName()
Returns the name of the base quantity.- Returns:
- The name of the base quantity. Shall not be
nullor empty.
-
getSymbol
public String getSymbol()
Returns the symbol of the base quantity.- Returns:
- The symbol of the base quantity. May be
null. If non-null, then shall not be empty.
-
getID
public final String getID()
Returns the identifier for the base quantity.
-
toString
public final String toString()
Returns the string representation of the base quantity.
-
equals
public boolean equals(Object object)
Indicates if this base quantity is semantically identical to an object.
-
hashCode
public int hashCode()
Returns the hash code of this instance.
-
compareTo
public int compareTo(BaseQuantity that)
Compares this base quantity to another base quantity.- Specified by:
compareToin interfaceComparable<BaseQuantity>- Parameters:
that- The BaseQuantity to compare against.- Returns:
- An integer that is negative, zero, or positive depending on
whether this BaseQuantity is less than, equal to, or greater than
that.
-
isDimensionless
public abstract boolean isDimensionless()
Indicates if this base quantity is dimensionless.- Specified by:
isDimensionlessin interfaceBase- Returns:
trueif an only if this BaseQuantity is dimensionless (e.g.BaseQuantity.SOLID_ANGLE).
-
-