gnu.math
Class BaseUnit
java.lang.Object
java.lang.Number
gnu.math.Numeric
gnu.math.Quantity
gnu.math.Unit
gnu.math.NamedUnit
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
Fields inherited from class gnu.math.Unit |
cm, Empty, gram, hour, in, meter, minute, mm, pica, pt, radian, second |
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)
|
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 java.lang.Number |
byteValue, shortValue |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
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)
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