com.rubecula.jquantity
Class BaseUnit

java.lang.Object
  |
  +--com.rubecula.jquantity.Item
        |
        +--com.rubecula.jquantity.BaseUnit
All Implemented Interfaces:
Auditable, java.lang.Comparable, Identifiable, Measurable, Presentable, java.io.Serializable
Direct Known Subclasses:
FlatUnit, SiUnit, UnitsFoundation

public abstract class BaseUnit
extends Item
implements Measurable

This abstract class represents, in its most primitive form, a unit of the Systeme International (SI). Only the dimension (type) of unit is represented here.

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

Constructor Summary
BaseUnit()
           
 
Method Summary
abstract  BaseUnit flatten()
          Method to reduce a Units tree to a single flattened version.
(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 isNumber()
          Method to determine if this is dimensionless (i.e.
 boolean isParallel(Measurable that)
          Method to determine if this Measurable is parallel to that Measurable.
 
Methods inherited from class com.rubecula.jquantity.Item
audit, audit, compareTo, Debug, getClassNameShort, getType, IsDebug, present, SetDebug, test, test, toString, Wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.jquantity.Measurable
getDimensions, getOffset, getScale
 
Methods inherited from interface com.rubecula.util.Presentable
makePresentableInstance, present
 
Methods inherited from interface com.rubecula.util.Auditable
audit
 
Methods inherited from interface com.rubecula.util.Identifiable
getIdentifier
 

Constructor Detail

BaseUnit

public BaseUnit()
Method Detail

flatten

public abstract BaseUnit flatten()
                          throws JQuantityException
Method to reduce a Units tree to a single flattened version.

Returns:
the equivalent FlatUnit.
Throws:
JQuantityException

isInSystem

public boolean isInSystem(int sysIndex)
Method to determine if this Measurable is in a certain system of units.

Parameters:
sysIndex - the index of the units system.
Returns:
true of this Measurable belongs to System defined by sysIndex.

isNumber

public boolean isNumber()
Method to determine if this is dimensionless (i.e. unitless).

Returns:
true if not in any System.

isParallel

public boolean isParallel(Measurable that)
Method to determine if this Measurable is parallel to that Measurable.

Parameters:
that - the Measurable to compare.
Returns:
true if the Dimensions of the Measurables are the same, i.e. if the Measurables differ only by a scale or offset.

isEqual

boolean isEqual(Measurable other)
Method to determine if this BaseUnit is equivalent to that Measurable.

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