pnuts.ext
Class UnitSystem
java.lang.Object
|
+--pnuts.ext.UnitSystem
- All Implemented Interfaces:
- QuantityFactory, java.io.Serializable
- public class UnitSystem
- extends java.lang.Object
- implements QuantityFactory, java.io.Serializable
This class defines a unit system in Pnuts.
When an identifier follows a decimal number, the identifier should
be one of the units symbols defined.
UnitSystem(["cm", "m"], [1, 100])
1cm + 1m ==> 101.000cm
- See Also:
- Serialized Form
Constructor Summary |
UnitSystem(java.lang.String[] units,
java.lang.Number[] scale,
Context context)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnitSystem
public UnitSystem(java.lang.String[] units,
java.lang.Number[] scale,
Context context)
init
public void init(Context context)
setPrecision
public void setPrecision(int prec)
make
public java.lang.Object make(java.lang.Number n,
java.lang.String unit)
- Specified by:
make
in interface QuantityFactory