ucar.units
Class BaseQuantity

java.lang.Object
  extended by 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).

Version:
$Id: BaseQuantity.java 64 2006-07-12 22:30:50Z edavis $
Author:
Steven R. Emmerson
See Also:
Serialized Form

Field Summary
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
  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
 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.
static void main(String[] args)
          Tests this class.
 String toString()
          Returns the string representation of the base quantity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 neither null nor empty.
symbol - Symbol for the base quantity. May be null but shall not be empty.
Throws:
NameException - name is null 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 neither null nor empty.
symbol - Symbol for the base quantity. May be null 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.

Specified by:
getID in interface Base
Returns:
The base quantity's identifier (i.e. symbol or name).

toString

public final String toString()
Returns the string representation of the base quantity.

Overrides:
toString in class Object
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.

Specified by:
equals in interface Base
Overrides:
equals in class Object
Parameters:
object - The object to examine.
Returns:
true if an only if this base quantity is semantically identical to object.

hashCode

public int hashCode()
Returns the hash code of this instance.

Overrides:
hashCode in class Object
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 interface Comparable<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 interface Base
Returns:
true if an only if this BaseQuantity is dimensionless (e.g. BaseQuantity.SOLID_ANGLE).

main

public static void main(String[] args)
Tests this class.



Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.