pnuts.ext
Class Quantity

java.lang.Object
  |
  +--pnuts.ext.Quantity

public class Quantity
extends java.lang.Object
implements Numeric, java.io.Serializable

This class represents a quantity with a unit. pnuts.ext.UnitSystem class is "factory" class for this class.

See Also:
Serialized Form

Fields inherited from interface pnuts.lang.Numeric
EQUAL, LEFT_IS_BIGGER, NOT_EQUAL, RIGHT_IS_BIGGER
 
Method Summary
 java.lang.Object add(java.lang.Object o)
          adds the value of parameter to itself
 int compareTo(java.lang.Object o)
          compare the object with the parameter.
 java.lang.Object divide(java.lang.Object o)
          divides itself by the value of parameter
 java.lang.Object inverse()
          inverts itself
static Quantity make(UnitSystem sys, java.lang.Number n, java.lang.String unit)
           
 java.lang.Object multiply(java.lang.Object o)
          multiplies itself with the value of parameter
 java.lang.Object negate()
          negates itself by the value of parameter
 java.lang.Number number()
           
 java.lang.Object subtract(java.lang.Object o)
          subtracts the value of parameter from the object
 java.lang.String toString()
           
 pnuts.ext.Units units()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

make

public static Quantity make(UnitSystem sys,
                            java.lang.Number n,
                            java.lang.String unit)

units

public pnuts.ext.Units units()

number

public java.lang.Number number()

multiply

public java.lang.Object multiply(java.lang.Object o)
Description copied from interface: Numeric
multiplies itself with the value of parameter
Specified by:
multiply in interface Numeric

divide

public java.lang.Object divide(java.lang.Object o)
Description copied from interface: Numeric
divides itself by the value of parameter
Specified by:
divide in interface Numeric

add

public java.lang.Object add(java.lang.Object o)
Description copied from interface: Numeric
adds the value of parameter to itself
Specified by:
add in interface Numeric

subtract

public java.lang.Object subtract(java.lang.Object o)
Description copied from interface: Numeric
subtracts the value of parameter from the object
Specified by:
subtract in interface Numeric

compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: Numeric
compare the object with the parameter. returns one of the followings: NOT_EQUAL, LEFT_IS_BIGGER, RIGHT_IS_BIGGER, EQUAL
Specified by:
compareTo in interface Numeric

negate

public java.lang.Object negate()
Description copied from interface: Numeric
negates itself by the value of parameter
Specified by:
negate in interface Numeric

inverse

public java.lang.Object inverse()
Description copied from interface: Numeric
inverts itself
Specified by:
inverse in interface Numeric

toString

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