com.rubecula.units
Class UnitsAll

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended bycom.rubecula.util.StringMap
              extended bycom.rubecula.units.UnitsTable
                  extended bycom.rubecula.units.UnitsSI
                      extended bycom.rubecula.units.UnitsAll
All Implemented Interfaces:
java.lang.Cloneable, Identifiable, java.util.Map, java.io.Serializable

public class UnitsAll
extends UnitsSI

Class to model all units.

Since:
V_0_0
Version:
$Revision: 1.5 $
Author:
Robin Hillyard
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.HashMap
 
Nested classes inherited from class java.util.AbstractMap
 
Field Summary
private  java.util.Vector _Tables
          The table of other units systems.
static UnitsAll $
           
 
Fields inherited from class com.rubecula.units.UnitsTable
 
Fields inherited from class java.util.HashMap
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
UnitsAll()
          Constructor to create a table of just the SI units.
 
Method Summary
 void add(UnitsTable table)
          Add a table to the UnitsAll instance.
 Measurable assign(Measurable unit)
           
 void audit(java.io.PrintStream stream)
           
 boolean contains(java.lang.String name)
           
 Measurable findParallel(Measurable units, SystemFlag system, boolean named)
          Method to find a parallel units in the same system as units, failing that a parallel units in the SI system, failing that return units.
 Measurable lookup(java.lang.String name)
          Method to lookup a Measurable by key.
 Measurable lookup(java.lang.String name, boolean matchOK)
          Method to lookup a Measurable by key (or by matching the name if matchOK is true) in this UnitsTable.
static void main(java.lang.String[] args)
           
 
Methods inherited from class com.rubecula.units.UnitsSI
put
 
Methods inherited from class com.rubecula.units.UnitsTable
findParallel, findParallel, getIdentifier, getName, getSystem, match, toString
 
Methods inherited from class com.rubecula.util.StringMap
get, get, put, put
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

$

public static final UnitsAll $

_Tables

private final java.util.Vector _Tables
The table of other units systems.

Constructor Detail

UnitsAll

public UnitsAll()
Constructor to create a table of just the SI units.

Method Detail

add

public void add(UnitsTable table)
Add a table to the UnitsAll instance.

Parameters:
table - a table of units such as a UnitsCGSor UnitsImperial.

contains

public boolean contains(java.lang.String name)
Parameters:
name - the name of the Units to be found.
Returns:
true if the units was found.

assign

public Measurable assign(Measurable unit)

main

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

audit

public void audit(java.io.PrintStream stream)
Overrides:
audit in class UnitsTable

lookup

public Measurable lookup(java.lang.String name,
                         boolean matchOK)
Description copied from class: UnitsTable
Method to lookup a Measurable by key (or by matching the name if matchOK is true) in this UnitsTable.

Overrides:
lookup in class UnitsTable
Parameters:
name - the key of the desired Measurable, or (if matchOK true) a string which will match one of the elements in the table (the first to be found).
matchOK - true if it is OK to accept a Measurable whose name matches when the name does not match a key.
Returns:
the (unique) Measurable whose key is name else any Measurable in the table which "matches" the name.

lookup

public Measurable lookup(java.lang.String name)
Description copied from class: UnitsTable
Method to lookup a Measurable by key.

Overrides:
lookup in class UnitsTable
Parameters:
name - the key of the desired Measurable
Returns:
the (unique) Measurable whose key is name.

findParallel

public Measurable findParallel(Measurable units,
                               SystemFlag system,
                               boolean named)
Method to find a parallel units in the same system as units, failing that a parallel units in the SI system, failing that return units.

Overrides:
findParallel in class UnitsTable
Parameters:
units - the units to match with one in this table.
system - the system to which result must belong (or null if don't care).
named - whether or not we insist that the parallel unit found must be named.
Returns:
the first Measurable which was found in this table that is also parallel to units and (if named is true) is named.
See Also:
UnitsTable.findParallel(Measurable, SystemFlag)