org.javaseis.properties
Class Units

java.lang.Object
  extended by org.javaseis.properties.Units
All Implemented Interfaces:
java.io.Serializable

public class Units
extends java.lang.Object
implements java.io.Serializable

This class provides a type-safe representation of units.

See Also:
Serialized Form

Field Summary
static Units DEGREES
          DEGREES of an angle
static Units FEET
          Feet
static Units FT
          Synonym for Feet such that FT.equals(FEET).
static Units HERTZ
          HERTZ
static Units HZ
          Synonym for HERTZ such that HZ.equals(HERTZ)
static Units M
          Synonym for Meters such that M.equals(METERS)
static Units METERS
          Meters
static Units MILLISECONDS
          MILLISECONDS
static Units MS
          Synonym for MILLISECONDS such that MS.equals(MILLISECONDS)
static Units MSEC
          Synonym for MILLISECONDS such that MSEC.equals(MILLISECONDS)
static Units NULL
          Unspecified value
static Units SECONDS
          SECONDS
(package private) static long serialVersionUID
           
static Units UNKNOWN
          Unknown value
 
Constructor Summary
Units(java.lang.String name)
          Creates a new Units object with the description equal to the name.
Units(java.lang.String name, java.lang.String description)
          Creates a new Units object with a description.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is equal to this object.
static Units get(java.lang.String name)
          Gets the units based on the name, or null if the name is not found.
 java.lang.String getDescription()
          Returns the description the units.
 java.lang.String getName()
          Returns the name the units.
 int hashCode()
          Overrides Object.hashCode() because this class overrides Object.equals().
 java.lang.String toString()
          Returns a String representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEGREES

public static final Units DEGREES
DEGREES of an angle


FEET

public static final Units FEET
Feet


FT

public static final Units FT
Synonym for Feet such that FT.equals(FEET).


HERTZ

public static final Units HERTZ
HERTZ


HZ

public static final Units HZ
Synonym for HERTZ such that HZ.equals(HERTZ)


M

public static final Units M
Synonym for Meters such that M.equals(METERS)


METERS

public static final Units METERS
Meters


MILLISECONDS

public static final Units MILLISECONDS
MILLISECONDS


MS

public static final Units MS
Synonym for MILLISECONDS such that MS.equals(MILLISECONDS)


MSEC

public static final Units MSEC
Synonym for MILLISECONDS such that MSEC.equals(MILLISECONDS)


NULL

public static final Units NULL
Unspecified value


SECONDS

public static final Units SECONDS
SECONDS


serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

UNKNOWN

public static final Units UNKNOWN
Unknown value

Constructor Detail

Units

public Units(java.lang.String name)
Creates a new Units object with the description equal to the name.

Parameters:
name - the units name. All names are reduced to lower case to avoid similar but different names.

Units

public Units(java.lang.String name,
             java.lang.String description)
Creates a new Units object with a description.

Parameters:
name - the units name. All names are reduced to lower case to avoid similar but different names.
description - a description of the units.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is equal to this object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - an object.
Returns:
true if the input object equals this object, otherwise false.

get

public static Units get(java.lang.String name)
Gets the units based on the name, or null if the name is not found.

Parameters:
name - the name of the units.
Returns:
the units, or null if the name is not found.

getDescription

public java.lang.String getDescription()
Returns the description the units.

Returns:
the description of the units.

getName

public java.lang.String getName()
Returns the name the units.

Returns:
the name of the units.

hashCode

public int hashCode()
Overrides Object.hashCode() because this class overrides Object.equals(). If a.equals(b), then a.hashCode()==b.hashCode(). If a.hashCode()!=b.hashCode(), then !a.equals(b).

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a String representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the object.