gnu.math
Class Unit

java.lang.Object
  extended by java.lang.Number
      extended by gnu.math.Numeric
          extended by gnu.math.Quantity
              extended by gnu.math.Unit
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NamedUnit

public abstract class Unit
extends Quantity

See Also:
Serialized Form

Field Summary
static Unit cm
           
static BaseUnit Empty
           
static BaseUnit gram
           
static Unit hour
           
static Unit in
           
static BaseUnit meter
           
static Unit minute
           
static Unit mm
           
static Unit pica
           
static Unit pt
           
static Unit radian
           
static BaseUnit second
           
 
Fields inherited from class gnu.math.Numeric
CEILING, FLOOR, ROUND, TRUNCATE
 
Method Summary
static Unit define(java.lang.String name, double factor, Unit base)
           
static Unit define(java.lang.String name, DQuantity value)
           
 Dimensions dimensions()
           
static Unit divide(Unit unit1, Unit unit2)
           
 double doubleValue()
          The value of the real component, as a double.
 java.lang.String getName()
           
 int hashCode()
           
 boolean isExact()
           
 boolean isZero()
           
static NamedUnit lookup(java.lang.String name)
           
static NamedUnit make(java.lang.String name, Quantity value)
           
 Complex number()
           
static Unit pow(Unit unit, int power)
           
 Numeric power(IntNum y)
          Return this raised to an integer power.
 Unit sqrt()
           
static Unit times(Unit unit1, Unit unit2)
           
 java.lang.String toString()
           
 java.lang.String toString(double val)
           
 java.lang.String toString(RealNum val)
           
 Unit unit()
           
 
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
 

Field Detail

Empty

public static BaseUnit Empty

meter

public static final BaseUnit meter

second

public static final BaseUnit second

gram

public static final BaseUnit gram

cm

public static final Unit cm

mm

public static final Unit mm

in

public static final Unit in

pt

public static final Unit pt

pica

public static final Unit pica

radian

public static final Unit radian

minute

public static final Unit minute

hour

public static final Unit hour
Method Detail

dimensions

public final Dimensions dimensions()
Overrides:
dimensions in class Quantity

doubleValue

public final double doubleValue()
Description copied from class: Quantity
The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.

Overrides:
doubleValue in class Quantity

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getName

public java.lang.String getName()

times

public static Unit times(Unit unit1,
                         Unit unit2)

divide

public static Unit divide(Unit unit1,
                          Unit unit2)

pow

public static Unit pow(Unit unit,
                       int power)

make

public static NamedUnit make(java.lang.String name,
                             Quantity value)

define

public static Unit define(java.lang.String name,
                          DQuantity value)

define

public static Unit define(java.lang.String name,
                          double factor,
                          Unit base)

number

public Complex number()
Specified by:
number in class Quantity

isExact

public boolean isExact()
Specified by:
isExact in class Numeric

isZero

public final boolean isZero()
Specified by:
isZero in class Numeric

power

public Numeric power(IntNum y)
Description copied from class: Numeric
Return this raised to an integer power. Implemented by repeated squaring and multiplication. If y < 0, returns div_inv of the result.

Overrides:
power in class Numeric

sqrt

public Unit sqrt()

lookup

public static NamedUnit lookup(java.lang.String name)

toString

public java.lang.String toString(double val)

toString

public java.lang.String toString(RealNum val)

toString

public java.lang.String toString()
Overrides:
toString in class Numeric

unit

public Unit unit()
Overrides:
unit in class Quantity