com.rubecula.jquantity
Class BaseUnit

java.lang.Object
  extended bycom.rubecula.util.Item
      extended bycom.rubecula.jquantity.BaseUnit
All Implemented Interfaces:
com.rubecula.util.Auditable, Comparable, com.rubecula.util.Identifiable, Measurable, com.rubecula.util.Presentable, Serializable
Direct Known Subclasses:
FlatUnit, SiUnit, UnitsFoundation

public abstract class BaseUnit
extends com.rubecula.util.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.6 $
Author:
Robin Hillyard
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.rubecula.util.Item
JQUANTITY_TEST
 
Constructor Summary
BaseUnit()
           
 
Method Summary
(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. unitless).
 boolean isParallel(Measurable that)
          Method to determine if this Measurable is parallel to that Measurable.
 boolean isParallelInSystem(Measurable that, SystemFlag system)
          Method to determine if this Measurable is parallel to that Measurable AND if this is in the system specified.
 
Methods inherited from class com.rubecula.util.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
flatten, getDimensions, getOffset, getScale, getSystem
 
Methods inherited from interface com.rubecula.util.Identifiable
getIdentifier
 
Methods inherited from interface com.rubecula.util.Presentable
makePresentableInstance, present
 
Methods inherited from interface com.rubecula.util.Auditable
audit
 

Constructor Detail

BaseUnit

public BaseUnit()
Method Detail

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).

Specified by:
isNumber in interface Measurable
Returns:
true if not in any System.

isParallelInSystem

public boolean isParallelInSystem(Measurable that,
                                  SystemFlag system)
Method to determine if this Measurable is parallel to that Measurable AND if this is in the system specified.

Parameters:
that - the Measurable to compare.
system - the system to which this must belong (or null if don't care).
Returns:
true if the Dimensions of the Measurables are the same, i.e. if the Measurables differ only by a scale or offset.

isParallel

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

Specified by:
isParallel in interface 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.