com.rubecula.jquantity
Class FlatUnit

java.lang.Object
  |
  +--com.rubecula.jquantity.BaseUnit
        |
        +--com.rubecula.jquantity.FlatUnit
All Implemented Interfaces:
Measurable

class FlatUnit
extends BaseUnit

The public class FlatUnit is used to describe a Measurable which has been flattened out so that all its dimensions and its scale are readily apparent.

Version:
$Revision: 1.1 $
Author:
Robin Hillyard

Constructor Summary
(package private) FlatUnit(Dimensions dimensions, Rational scale)
          Primary constructor to create a FlatUnit.
(package private) FlatUnit(Measurable other)
          Constructor to copy another Measurable.
 
Method Summary
 BaseUnit flatten()
          Method to reduce a Units tree to a single flattened version.
 Dimensions getDimensions()
          Method to return the dimensions of this Measurable.
 java.lang.String getName()
           
 Rational getOffset()
          Method to return the offset of this Measurable.
 Rational getScale()
          Method to return the scale of this Measurable.
 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.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 
Methods inherited from class com.rubecula.jquantity.BaseUnit
isParallel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FlatUnit

FlatUnit(Dimensions dimensions,
         Rational scale)
Primary constructor to create a FlatUnit.

Parameters:
dimensions - the Dimensions to use.
scale - the scale to use.

FlatUnit

FlatUnit(Measurable other)
   throws JQuantityException
Constructor to copy another Measurable.

Parameters:
other - that other Measurable.
Throws:
JQuantityException
Method Detail

getDimensions

public Dimensions getDimensions()
Method to return the dimensions of this Measurable.

Returns:
the Dimensions.

getScale

public Rational getScale()
Method to return the scale of this Measurable.

Returns:
the scale.

getOffset

public Rational getOffset()
Method to return the offset of this Measurable.

Returns:
the offset, usually $0.

isInSystem

public boolean isInSystem(int sysIndex)
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 JQuantityException
Method to reduce a Units tree to a single flattened version.

Specified by:
flatten in class BaseUnit
Returns:
the equivalent FlatUnit.
Throws:
JQuantityException

isNumber

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

Overrides:
isNumber in class BaseUnit
Returns:
true if not in any System.

getName

public final java.lang.String getName()

isEqual

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

toString

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

main

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