com.rubecula.units
Class Units

java.lang.Object
  extended bycom.rubecula.util.Item
      extended bycom.rubecula.units.BaseUnit
          extended bycom.rubecula.units.UnitsFoundation
              extended bycom.rubecula.units.Units
All Implemented Interfaces:
Auditable, java.lang.Cloneable, java.lang.Comparable, Identifiable, Measurable, Mutable, Nameable, Presentable, java.io.Serializable

public class Units
extends UnitsFoundation
implements Measurable, Mutable, Auditable

This class extends UnitsFoundation by adding instance fields: _A, _B, _PowerA, _PowerB, _Scale, _Offset and _System.

New version of Units introduced February 2002.
In this new version, we make use of an Interface Measurable which provides both the scale and the dimensions of a unit. There are three implementers of Measurable:

This class is not yet fully implemented.

// TODO Consider extending java.util.Currency // TODO Ensure compliance. // TODO Change constant names to form $...

Version:
$Revision: 1.8 $
Author:
Robin Hillyard
See Also:
Serialized Form

Field Summary
private  Measurable _A
           
private  Measurable _B
           
private  Rational _Offset
           
private  Rational _PowerA
           
private  Rational _PowerB
           
private  Rational _Scale
           
private  SystemFlag _System
           
private static Rational $60
           
protected static java.lang.String $S_KG_PER_POUND
           
protected static java.lang.String $S_M_PER_FOOT
           
static java.lang.String AA
           
static java.lang.String AAC
           
private static java.lang.String AMP
           
static Units Ampere
           
private static java.lang.String ANGAM
           
private static java.lang.String ANGAS
           
private static java.lang.String ANGD
           
private static java.lang.String ANGG
           
private static java.lang.String ANGR
           
private static java.lang.String ANGX
           
static Units ArcMinute
           
static Units ArcSecond
           
private static Units[][] BaseUnits
           
static Units Candela
           
static Units Centimeter
           
private static java.lang.String CHRG
           
static Units Coulomb
           
private static java.lang.String CUSD
           
static Units Day
           
private static java.lang.String DEGC
           
private static java.lang.String DEGK
           
static java.lang.String DEGR
           
static Units Degree
           
static Units DollarUS
           
private static java.lang.String DSTA
           
static java.lang.String DSTAU
           
private static java.lang.String DSTCM
           
static java.lang.String DSTDM
           
private static java.lang.String DSTF
           
static java.lang.String DSTHM
           
static java.lang.String DSTI
           
static java.lang.String DSTKM
           
private static java.lang.String DSTLS
           
private static java.lang.String DSTM
           
private static java.lang.String DSTMM
           
static java.lang.String DSTY
           
static java.lang.String ERGE
           
private static java.lang.String ERGJ
           
static Units Flux
           
static Units Foot
           
static java.lang.String FRCD
           
private static java.lang.String FRCN
           
private static java.lang.String FREQ
           
static Units G
           
private static java.lang.String GMS
           
static Units Grad
           
static Units Gram
           
static Units GravConstUnits
           
static Units Henry
           
static Units Hertz
           
static Units Hour
           
static Rational Hundred
           
static Rational Hundredth
           
private static java.lang.String INDCT
           
static Units Joule
           
static Units Kelvin
           
static Units Kepler
           
static Units Kilogram
           
private static Units KilogramPerSecondSquared
           
private static java.lang.String LIGHT
           
static Units LightSecond
           
private static java.lang.String MASG
           
private static java.lang.String MASK
           
static java.lang.String MASO
           
private static java.lang.String MASP
           
static Units Meter
           
private static Units MeterCubed
           
static Units MeterPerSecond
           
static Units MeterPerSecondAllSquared
           
static Units MeterPerSecondSquared
           
private static java.lang.String MFD
           
private static java.lang.String MFLX
           
static Units Minute
           
static Units Mole
           
static Units Newton
           
static Units None
           
static Units Pascal
           
static Units Permeability
           
static Units PerMeter
           
static Units Permittivity
           
static Units Pound
           
private static java.lang.String POWW
           
private static java.lang.String PRSP
           
private static java.lang.String QTY
           
static Units Radian
           
static Units Rightangle
           
static Units Second
           
private static Units SecondSquared
           
static Rational Ten
           
static Rational Tenth
           
static Units Tesla
           
static Rational Thousand
           
static Rational Thousandth
           
private static java.lang.String TIMD
           
private static java.lang.String TIMH
           
private static java.lang.String TIMM
           
private static java.lang.String TIMS
           
private static java.lang.String TIMW
           
private static java.lang.String TIMY
           
private static java.lang.String VMS
           
static Units Volt
           
private static java.lang.String VOLT
           
static Units Watt
           
static Units Weber
           
private static java.lang.String ZFlux
           
private static java.lang.String ZKepler
           
private static java.lang.String ZPermeability
           
private static java.lang.String ZPermittivity
           
private static java.lang.String ZReciprocalMeter
           
 
Fields inherited from class com.rubecula.units.UnitsFoundation
_Name, UNITS_TEST
 
Fields inherited from class com.rubecula.util.Item
JQUANTITY_TEST
 
Constructor Summary
(package private) Units(Measurable base)
           
(package private) Units(java.lang.String name, Measurable base)
           
(package private) Units(java.lang.String name, Measurable base, SystemFlag flag)
           
  Units(UnitsName name, SystemFlag system, Rational scale, Measurable A)
           
(package private) Units(UnitsName name, SystemFlag system, Rational scale, Rational powerA, Measurable A)
           
(package private) Units(UnitsName name, SystemFlag system, Rational scale, Rational powerA, Measurable A, Rational powerB, Measurable B)
           
(package private) Units(UnitsName name, SystemFlag system, Rational scale, Rational powerA, Measurable A, Rational powerB, Measurable B, Rational offset)
           
 
Method Summary
(package private)  void audit(int indent)
           
 void audit(java.io.PrintStream out)
           
 java.lang.Object clone()
          Creates and returns a copy of this Units.
(package private)  Units combine(Rational powerA, Measurable B, Rational powerB)
           
 int compareTo(Measurable val)
          Compares this Units with the specified Measurable.
 int compareTo(java.lang.Object val)
          Compares this Units with the specified Object.
 Measurable convertToSystem(int systemIndex)
          method convertToSystem forces the system index of the result to be systemIndex (scaling as appropriate).
(package private)  Units difference(Measurable addend)
           
 BaseUnit flatten()
          Method to reduce a Units tree to a single flattened version.
(package private)  int getCommonSysIndex(Units that)
           
private  java.lang.String getDescription()
           
 Dimensions getDimensions()
          Method to return the dimensions of this Measurable.
 Rational getOffset()
          Method to return the offset of this Measurable.
 Rational getScale()
          Method to return the scale of this Measurable.
 SystemFlag getSystem()
           
(package private)  Units halve()
           
 int hashCode()
           
 boolean identity()
           
 boolean isAngular()
           
(package private)  boolean isEqual(Measurable other)
          Method to determine if this BaseUnit is equivalent to that Measurable.
 boolean isInSystem(int sysIndex)
          Method to determine if this Measurable is in a certain system of units.
 boolean isMutable()
          This method indicates whether this particular instance is mutable, i.e. it has not been designated a constant.
static void main(java.lang.String[] args)
           
 Presentable makePresentableInstance(Presentation presentation)
          Instance method to convert a Presentation into a Presentable.
 Units minus()
           
private  void monitor(java.lang.String method, java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
           
private static Rational nonZeroDivide(Rational num, long denom)
           
 Presentation present(AttrMap attributes)
          Convert this Presentable object into a Presentation, according to the set of attributes provided.
 Units productScalar(Rational power)
           
(package private)  Units rename(java.lang.String name)
           
(package private)  Units scale(int scale)
          Scale this unit.
(package private)  Units scale(Rational scale)
          Scale this unit.
(package private)  Units scale(UnitsName name, int scale)
          Scale this unit and assign a new name to the result.
(package private)  Units scale(UnitsName name, int scale, SystemFlag system)
          Scale this unit and assign a new name and system to the result.
 Units scale(UnitsName name, Rational scale)
          Scale this unit and assign a new name to the result.
(package private)  Units scale(UnitsName name, Rational scale, SystemFlag system)
          Scale this unit and assign a new name and system to the result.
 Rational scaleToUnits(Measurable base, Rational value)
          This method converts value which is expressed in this Units into a value expressed in base units.
 Mutable setConstant()
          This method sets this instance to be a constant, i.e. immutable.
private static boolean stringComposite(java.lang.String string)
           
 Units sum(Measurable addend)
           
static Measurable Sum(Measurable x, Measurable y)
           
 Units sum(Measurable addend, Rational power)
           
 java.lang.String toString()
          This is the default toString method for all Items.
 java.lang.String toString(int sysIndex)
           
 
Methods inherited from class com.rubecula.units.UnitsFoundation
audit, audit, audit, getIdentifier, isNumber, monitor, normalize, setIdentifier, setName, setName, setName, setName, setName, setName
 
Methods inherited from class com.rubecula.units.BaseUnit
isParallel, isParallelInSystem
 
Methods inherited from class com.rubecula.util.Item
Debug, getClassNameShort, getType, IsDebug, present, SetDebug, test, test, Wrap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.units.Measurable
isNumber, isParallel
 
Methods inherited from interface com.rubecula.util.Identifiable
getIdentifier
 
Methods inherited from interface com.rubecula.util.Auditable
audit, audit, audit
 

Field Detail

_System

private final SystemFlag _System

_Scale

private final Rational _Scale

_Offset

private final Rational _Offset

_PowerA

private final Rational _PowerA

_A

private final Measurable _A

_PowerB

private final Rational _PowerB

_B

private final Measurable _B

ANGD

private static final java.lang.String ANGD
See Also:
Constant Field Values

ANGR

private static final java.lang.String ANGR
See Also:
Constant Field Values

ANGX

private static final java.lang.String ANGX
See Also:
Constant Field Values

ANGG

private static final java.lang.String ANGG
See Also:
Constant Field Values

ANGAS

private static final java.lang.String ANGAS
See Also:
Constant Field Values

ANGAM

private static final java.lang.String ANGAM
See Also:
Constant Field Values

CUSD

private static final java.lang.String CUSD
See Also:
Constant Field Values

DEGC

private static final java.lang.String DEGC
See Also:
Constant Field Values

DEGK

private static final java.lang.String DEGK
See Also:
Constant Field Values

DEGR

public static final java.lang.String DEGR
See Also:
Constant Field Values

DSTM

private static final java.lang.String DSTM
See Also:
Constant Field Values

DSTDM

public static final java.lang.String DSTDM
See Also:
Constant Field Values

DSTHM

public static final java.lang.String DSTHM
See Also:
Constant Field Values

DSTKM

public static final java.lang.String DSTKM
See Also:
Constant Field Values

DSTCM

private static final java.lang.String DSTCM
See Also:
Constant Field Values

DSTMM

private static final java.lang.String DSTMM
See Also:
Constant Field Values

DSTA

private static final java.lang.String DSTA
See Also:
Constant Field Values

DSTF

private static final java.lang.String DSTF
See Also:
Constant Field Values

DSTI

public static final java.lang.String DSTI
See Also:
Constant Field Values

DSTY

public static final java.lang.String DSTY
See Also:
Constant Field Values

DSTAU

public static final java.lang.String DSTAU
See Also:
Constant Field Values

DSTLS

private static final java.lang.String DSTLS
See Also:
Constant Field Values

TIMS

private static final java.lang.String TIMS
See Also:
Constant Field Values

TIMM

private static final java.lang.String TIMM
See Also:
Constant Field Values

TIMH

private static final java.lang.String TIMH
See Also:
Constant Field Values

TIMD

private static final java.lang.String TIMD
See Also:
Constant Field Values

TIMY

private static final java.lang.String TIMY
See Also:
Constant Field Values

TIMW

private static final java.lang.String TIMW
See Also:
Constant Field Values

MASK

private static final java.lang.String MASK
See Also:
Constant Field Values

MASG

private static final java.lang.String MASG
See Also:
Constant Field Values

MASP

private static final java.lang.String MASP
See Also:
Constant Field Values

MASO

public static final java.lang.String MASO
See Also:
Constant Field Values

AMP

private static final java.lang.String AMP
See Also:
Constant Field Values

CHRG

private static final java.lang.String CHRG
See Also:
Constant Field Values

ERGJ

private static final java.lang.String ERGJ
See Also:
Constant Field Values

ERGE

public static final java.lang.String ERGE
See Also:
Constant Field Values

POWW

private static final java.lang.String POWW
See Also:
Constant Field Values

LIGHT

private static final java.lang.String LIGHT
See Also:
Constant Field Values

QTY

private static final java.lang.String QTY
See Also:
Constant Field Values

VOLT

private static final java.lang.String VOLT
See Also:
Constant Field Values

FREQ

private static final java.lang.String FREQ
See Also:
Constant Field Values

FRCN

private static final java.lang.String FRCN
See Also:
Constant Field Values

FRCD

public static final java.lang.String FRCD
See Also:
Constant Field Values

PRSP

private static final java.lang.String PRSP
See Also:
Constant Field Values

MFLX

private static final java.lang.String MFLX
See Also:
Constant Field Values

INDCT

private static final java.lang.String INDCT
See Also:
Constant Field Values

MFD

private static final java.lang.String MFD
See Also:
Constant Field Values

AA

public static final java.lang.String AA
See Also:
Constant Field Values

AAC

public static final java.lang.String AAC
See Also:
Constant Field Values

VMS

private static final java.lang.String VMS
See Also:
Constant Field Values

GMS

private static final java.lang.String GMS
See Also:
Constant Field Values

ZPermeability

private static final java.lang.String ZPermeability
See Also:
Constant Field Values

ZPermittivity

private static final java.lang.String ZPermittivity
See Also:
Constant Field Values

ZKepler

private static final java.lang.String ZKepler
See Also:
Constant Field Values

ZReciprocalMeter

private static final java.lang.String ZReciprocalMeter
See Also:
Constant Field Values

ZFlux

private static final java.lang.String ZFlux
See Also:
Constant Field Values

Ten

public static Rational Ten

Tenth

public static Rational Tenth

Hundred

public static Rational Hundred

Hundredth

public static Rational Hundredth

Thousand

public static Rational Thousand

Thousandth

public static Rational Thousandth

None

public static final Units None

Meter

public static final Units Meter

Second

public static final Units Second

Kilogram

public static final Units Kilogram

Radian

public static final Units Radian

Ampere

public static final Units Ampere

Kelvin

public static final Units Kelvin

Candela

public static final Units Candela

Mole

public static final Units Mole

DollarUS

public static final Units DollarUS

Minute

public static final Units Minute

Hour

public static final Units Hour

Day

public static final Units Day

Hertz

public static final Units Hertz

$60

private static final Rational $60

Degree

public static final Units Degree

ArcMinute

public static final Units ArcMinute

ArcSecond

public static final Units ArcSecond

Rightangle

public static final Units Rightangle

Grad

public static final Units Grad

Coulomb

public static final Units Coulomb

MeterPerSecond

public static final Units MeterPerSecond

PerMeter

public static final Units PerMeter

MeterCubed

private static final Units MeterCubed

SecondSquared

private static final Units SecondSquared

MeterPerSecondSquared

public static final Units MeterPerSecondSquared

KilogramPerSecondSquared

private static final Units KilogramPerSecondSquared

Newton

public static final Units Newton

Pascal

public static final Units Pascal

GravConstUnits

public static final Units GravConstUnits

MeterPerSecondAllSquared

public static final Units MeterPerSecondAllSquared

Joule

public static final Units Joule

G

public static final Units G

Watt

public static final Units Watt

Volt

public static final Units Volt

Weber

public static final Units Weber

Henry

public static final Units Henry

Tesla

public static final Units Tesla

Permeability

public static final Units Permeability

Permittivity

public static final Units Permittivity

Kepler

public static final Units Kepler

Flux

public static final Units Flux

Gram

public static final Units Gram

Centimeter

public static final Units Centimeter

$S_M_PER_FOOT

protected static final java.lang.String $S_M_PER_FOOT
See Also:
Constant Field Values

$S_KG_PER_POUND

protected static final java.lang.String $S_KG_PER_POUND
See Also:
Constant Field Values

LightSecond

public static final Units LightSecond

Pound

public static final Units Pound

Foot

public static final Units Foot

BaseUnits

private static final Units[][] BaseUnits
Constructor Detail

Units

Units(UnitsName name,
      SystemFlag system,
      Rational scale,
      Rational powerA,
      Measurable A,
      Rational powerB,
      Measurable B,
      Rational offset)

Units

Units(UnitsName name,
      SystemFlag system,
      Rational scale,
      Rational powerA,
      Measurable A,
      Rational powerB,
      Measurable B)

Units

Units(UnitsName name,
      SystemFlag system,
      Rational scale,
      Rational powerA,
      Measurable A)

Units

public Units(UnitsName name,
             SystemFlag system,
             Rational scale,
             Measurable A)

Units

Units(java.lang.String name,
      Measurable base,
      SystemFlag flag)

Units

Units(java.lang.String name,
      Measurable base)

Units

Units(Measurable base)
Method Detail

hashCode

public final int hashCode()

clone

public java.lang.Object clone()
Creates and returns a copy of this Units.

Returns:
a clone of this instance.
Throws:
java.lang.Exception - : not Cloneable (should be impossible)
See Also:
Cloneable

compareTo

public int compareTo(Measurable val)
Compares this Units with the specified Measurable.

Parameters:
val - Units to which this Measurable is to be compared.
Returns:
0 or 1 Units is equivalent/not-equivalent to val.

compareTo

public int compareTo(java.lang.Object val)
Compares this Units with the specified Object.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class Item
Parameters:
val - Object to which this Units is to be compared.
Returns:
0 or 1 Units is equivalent/not-equivalent to val.
See Also:
Object.getClass(), Class.isInstance(java.lang.Object), Class.getName(), Class.getSuperclass(), Method.invoke(java.lang.Object, java.lang.Object[]), Integer.intValue(), IllegalAccessException, InvocationTargetException, InvocationTargetException.getTargetException(), NoSuchMethodException, Class.getConstructor(java.lang.Class[]), Constructor.newInstance(java.lang.Object[])

getDimensions

public Dimensions getDimensions()
Description copied from interface: Measurable
Method to return the dimensions of this Measurable.

Specified by:
getDimensions in interface Measurable
Returns:
the Dimensions.

getScale

public Rational getScale()
Description copied from interface: Measurable
Method to return the scale of this Measurable.

Specified by:
getScale in interface Measurable
Returns:
the scale.

getOffset

public Rational getOffset()
Description copied from interface: Measurable
Method to return the offset of this Measurable.

Specified by:
getOffset in interface Measurable
Returns:
the offset, usually $0.

scale

final Units scale(UnitsName name,
                  Rational scale,
                  SystemFlag system)
Scale this unit and assign a new name and system to the result.

Parameters:
name - Name of scaled unit
scale - The scale. For example, when creating an inch from a millimeter the value of scale would be 254/10.
system - The system of the new unit.
Returns:
Newly formed unit

scale

public final Units scale(UnitsName name,
                         Rational scale)
Scale this unit and assign a new name to the result. Used when the system of the new unit is the same, for example when deriving one millimeter from a meter.

Parameters:
name - Name of scaled unit
scale - The scale. For example, when creating an inch from a millimeter the value of scale would be 254/10.
Returns:
Newly formed unit

scale

final Units scale(Rational scale)
Scale this unit. Used when the system of the new unit is the same, for example when deriving one millimeter from a meter.

Parameters:
scale - The scale. For example, when creating an inch from a millimeter the value of scale would be 254/10.
Returns:
Newly formed unnamed unit

scale

final Units scale(UnitsName name,
                  int scale,
                  SystemFlag system)
Scale this unit and assign a new name and system to the result.

Parameters:
name - Name of scaled unit
scale - The scale. For example, when creating a minute from a second the value of scale would be 60.
system - The system of the new unit.
Returns:
Newly formed unit

scale

final Units scale(UnitsName name,
                  int scale)
Scale this unit and assign a new name to the result. Used when the system of the new unit is the same, for example when deriving one millimeter from a meter.

Parameters:
name - Name of scaled unit
scale - The scale. For example, when creating a minute from a second the value of scale would be 60.
Returns:
Newly formed unit

scale

final Units scale(int scale)
Scale this unit. Used when the system of the new unit is the same, for example when deriving one millimeter from a meter.

Parameters:
scale - The scale. For example, when creating a minute from a second the value of scale would be 60.
Returns:
Newly formed unnamed unit

combine

final Units combine(Rational powerA,
                    Measurable B,
                    Rational powerB)

sum

public final Units sum(Measurable addend,
                       Rational power)

sum

public final Units sum(Measurable addend)

difference

final Units difference(Measurable addend)

productScalar

public final Units productScalar(Rational power)

minus

public final Units minus()

halve

final Units halve()
           throws UnitsException
Throws:
UnitsException

rename

final Units rename(java.lang.String name)

getSystem

public SystemFlag getSystem()
Specified by:
getSystem in interface Measurable

isInSystem

public boolean isInSystem(int sysIndex)
Description copied from class: BaseUnit
Method to determine if this Measurable is in a certain system of units.

Overrides:
isInSystem in class BaseUnit
Parameters:
sysIndex - the index of the units system.
Returns:
true of this Measurable belongs to System defined by sysIndex.

flatten

public BaseUnit flatten()
                 throws UnitsException
Description copied from interface: Measurable
Method to reduce a Units tree to a single flattened version.

Specified by:
flatten in interface Measurable
Returns:
the equivalent FlatUnit.
Throws:
UnitsException

isEqual

boolean isEqual(Measurable other)
Description copied from class: BaseUnit
Method to determine if this BaseUnit is equivalent to that Measurable.

Overrides:
isEqual in class BaseUnit
Parameters:
other - the Measurable to compare.
Returns:
true if isParallel(other) and if their respective scales and offsets are equal.

scaleToUnits

public final Rational scaleToUnits(Measurable base,
                                   Rational value)
                            throws UnitsException
This method converts value which is expressed in this Units into a value expressed in base units.

Parameters:
base - the units in which we want a value scaled.
value - the value to scale.
Returns:
a Rational which is the new value appropriately scaled.
Throws:
UnitsException

toString

public java.lang.String toString(int sysIndex)
Specified by:
toString in class UnitsFoundation

toString

public java.lang.String toString()
Description copied from class: Item
This is the default toString method for all Items. Specific classes will override as appropriate.

Overrides:
toString in class UnitsFoundation

audit

public void audit(java.io.PrintStream out)

present

public Presentation present(AttrMap attributes)
                     throws PresentationException
Convert this Presentable object into a Presentation, according to the set of attributes provided.

Specified by:
present in interface Presentable
Parameters:
attributes - a map of the attributes desired for the construction of the new presentation (may be empty).
Returns:
an appropriate instance of Presentation.
Throws:
PresentationException - in case of parsing error.

makePresentableInstance

public Presentable makePresentableInstance(Presentation presentation)
                                    throws PresentationException
Instance method to convert a Presentation into a Presentable. Ideally, this would be a class method, but such a method cannot be defined in an interface. Nor can it be defined in an abstract class with the intention of overriding it in a subclass. Polymorphism just doesn't work that way.
Therefore, the present value (as in fields) of the instance is essentially ignored - only the methods are important.

Specified by:
makePresentableInstance in interface Presentable
Parameters:
presentation - of a number to be converted into a Presentable number.
Returns:
a number in the form of a Presentable.
Throws:
PresentationException - in case of parsing error.

getDescription

private java.lang.String getDescription()

stringComposite

private static boolean stringComposite(java.lang.String string)

identity

public final boolean identity()
                       throws UnitsException
Throws:
UnitsException

isAngular

public final boolean isAngular()
                        throws UnitsException
Throws:
UnitsException

getCommonSysIndex

final int getCommonSysIndex(Units that)

audit

final void audit(int indent)

monitor

private void monitor(java.lang.String method,
                     java.lang.String arg0,
                     java.lang.String arg1,
                     java.lang.String arg2)

nonZeroDivide

private static Rational nonZeroDivide(Rational num,
                                      long denom)

convertToSystem

public final Measurable convertToSystem(int systemIndex)
method convertToSystem forces the system index of the result to be systemIndex (scaling as appropriate).

Parameters:
systemIndex - the system in which we want the returned value to be.
Returns:
a Units which is parallel to this but in the system defined by systemIndex.

main

public static void main(java.lang.String[] args)

isMutable

public boolean isMutable()
Description copied from interface: Mutable
This method indicates whether this particular instance is mutable, i.e. it has not been designated a constant.

Specified by:
isMutable in interface Mutable
Returns:
true if this instance can be mutated, otherwise false (it is constant).

setConstant

public Mutable setConstant()
Description copied from interface: Mutable
This method sets this instance to be a constant, i.e. immutable. Future calls to the isMutable() method will yield false.

Specified by:
setConstant in interface Mutable
Returns:
as a convenience this method returns itself.

Sum

public static Measurable Sum(Measurable x,
                             Measurable y)