Package 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:
Externalizable
,Serializable
public class BaseUnit extends NamedUnit implements Externalizable
A primitive Unit of measurement (such as a meter).- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
compare(BaseUnit unit1, BaseUnit unit2)
String
getDimension()
int
hashCode()
protected void
init()
static BaseUnit
lookup(String name, String dimension)
Look for an existing matching BaseUnit.static BaseUnit
make(String name, String dimension)
void
readExternal(ObjectInput in)
Object
readResolve()
Unit
unit()
void
writeExternal(ObjectOutput out)
-
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, doubleJmagValue, doubleKmagValue, im, imValue, jm, jmValue, km, kmValue, make, make, make, mul, mulReversed, neg, re, reValue, times, toString
-
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, equals, floatValue, geq, grt, intValue, longValue, mul_ident, sub, toExact, toInexact
-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Method Detail
-
getDimension
public String getDimension()
-
lookup
public static BaseUnit lookup(String name, 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".
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classNamedUnit
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classNamedUnit
- Throws:
IOException
ClassNotFoundException
-
readResolve
public Object readResolve() throws ObjectStreamException
- Overrides:
readResolve
in classNamedUnit
- Throws:
ObjectStreamException
-
-