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 RegularBaseQuantity
AMOUNT_OF_SUBSTANCE
The base quantity of amount of substance.static RegularBaseQuantity
ELECTRIC_CURRENT
The base quantity of electric current.static RegularBaseQuantity
LENGTH
The base quantity of length.static RegularBaseQuantity
LUMINOUS_INTENSITY
The base quantity of luminous intensity.static RegularBaseQuantity
MASS
The base quantity of mass.static SupplementaryBaseQuantity
PLANE_ANGLE
The base quantity of plane angle.static SupplementaryBaseQuantity
SOLID_ANGLE
The base quantity of solid angle.static RegularBaseQuantity
THERMODYNAMIC_TEMPERATURE
The base quantity of themodynamic temperature.static RegularBaseQuantity
TIME
The base quantity of time.static UnknownBaseQuantity
UNKNOWN
The unknown base quantity.
-
Constructor Summary
Constructors Modifier Constructor Description BaseQuantity(String name, String symbol)
Constructs from a name and a symbol.protected
BaseQuantity(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 int
compareTo(BaseQuantity that)
Compares this base quantity to another base quantity.boolean
equals(Object object)
Indicates if this base quantity is semantically identical to an object.String
getID()
Returns the identifier for the base quantity.String
getName()
Returns the name of the base quantity.String
getSymbol()
Returns the symbol of the base quantity.int
hashCode()
Returns the hash code of this instance.abstract boolean
isDimensionless()
Indicates if this base quantity is dimensionless.String
toString()
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 neithernull
nor empty.symbol
- Symbol for the base quantity. May benull
but shall not be empty.- Throws:
NameException
-name
isnull
or 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 neithernull
nor empty.symbol
- Symbol for the base quantity. May benull
but 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
null
or 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:
compareTo
in 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:
isDimensionless
in interfaceBase
- Returns:
true
if an only if this BaseQuantity is dimensionless (e.g.BaseQuantity.SOLID_ANGLE
).
-
-