gnu.math
Class BaseUnit

java.lang.Object
  extended by java.lang.Number
      extended by gnu.math.Numeric
          extended by gnu.math.Quantity
              extended by gnu.math.Unit
                  extended by gnu.math.NamedUnit
                      extended by gnu.math.BaseUnit
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class BaseUnit
extends NamedUnit
implements java.io.Externalizable

A primitive Unit of measurement (such as a meter).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.math.Unit
cm, Empty, gram, hour, in, meter, minute, mm, pica, pt, radian, second
 
Fields inherited from class gnu.math.Numeric
CEILING, FLOOR, ROUND, TRUNCATE
 
Constructor Summary
BaseUnit()
          Should only be used for serialization, and Unit.Empty.
BaseUnit(java.lang.String name)
           
BaseUnit(java.lang.String name, java.lang.String dimension)
           
 
Method Summary
static int compare(BaseUnit unit1, BaseUnit unit2)
           
 java.lang.String getDimension()
           
 int hashCode()
           
protected  void init()
           
static BaseUnit lookup(java.lang.String name, java.lang.String dimension)
          Look for an existing matching BaseUnit.
static BaseUnit make(java.lang.String name, java.lang.String dimension)
           
 void readExternal(java.io.ObjectInput in)
           
 java.lang.Object readResolve()
           
 Unit unit()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.math.NamedUnit
getName, lookup, lookup, make, make
 
Methods inherited from class gnu.math.Unit
define, define, dimensions, divide, doubleValue, isExact, isZero, number, pow, power, sqrt, times, toString, toString, toString
 
Methods inherited from class gnu.math.Quantity
abs, add, add, addReversed, compare, compare, compareReversed, div, divide, divReversed, doubleImagValue, im, imValue, make, make, make, mul, mulReversed, neg, re, reValue, times, toString
 
Methods inherited from class gnu.math.Numeric
add, div_inv, equals, floatValue, geq, grt, intValue, longValue, mul_ident, sub
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseUnit

public BaseUnit()
Should only be used for serialization, and Unit.Empty.


BaseUnit

public BaseUnit(java.lang.String name)

BaseUnit

public BaseUnit(java.lang.String name,
                java.lang.String dimension)
Method Detail

getDimension

public java.lang.String getDimension()

init

protected void init()
Overrides:
init in class NamedUnit

hashCode

public int hashCode()
Overrides:
hashCode in class Unit

unit

public Unit unit()
Overrides:
unit in class Unit

lookup

public static BaseUnit lookup(java.lang.String name,
                              java.lang.String dimension)
Look for an existing matching BaseUnit.

Parameters:
name - name of desired BaseUnit, such as "m"
dimension - a name for what the unit measures, such as "Length".

make

public static BaseUnit make(java.lang.String name,
                            java.lang.String dimension)

compare

public static int compare(BaseUnit unit1,
                          BaseUnit unit2)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class NamedUnit
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class NamedUnit
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readResolve

public java.lang.Object readResolve()
                             throws java.io.ObjectStreamException
Overrides:
readResolve in class NamedUnit
Throws:
java.io.ObjectStreamException