com.rubecula.jquantity
Class UnitsAll
java.lang.Object
java.util.AbstractMap
java.util.HashMap
com.rubecula.jquantity.UnitsTable
com.rubecula.jquantity.UnitsSI
com.rubecula.jquantity.UnitsAll
- All Implemented Interfaces:
- Cloneable, com.rubecula.util.Identifiable, Map, Serializable
- public class UnitsAll
- extends UnitsSI
Class to model all units.
- Since:
- V_0_0
- Version:
- $Revision: 1.11 $
- Author:
- Robin Hillyard
- See Also:
- Serialized Form
Nested classes inherited from class java.util.HashMap |
|
Nested classes inherited from class java.util.AbstractMap |
|
Fields inherited from class com.rubecula.jquantity.UnitsTable |
|
Fields inherited from class java.util.HashMap |
|
Constructor Summary |
UnitsAll()
Constructor to create a table of just the SI units. |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
$
public static final UnitsAll $
_Tables
private final Vector _Tables
- The table of other units systems.
UnitsAll
public UnitsAll()
- Constructor to create a table of just the SI units.
add
public void add(UnitsTable table)
- Add a table to the UnitsAll instance.
- Parameters:
table
- a table of units such as a UnitsCGS
or
UnitsImperial
.
contains
public boolean contains(String name)
- Parameters:
name
- the name of the Units to be found.
- Returns:
- true if the units was found.
put
Measurable put(Measurable unit)
- Description copied from class:
UnitsTable
- Method to insert a unit in this table. Successful insertion depends on
the value of the unit's identifier. If it's not null, then an insertion
will be made provided that there is no existing entry of the same name
(else an exception will be thrown). If it's null, then no insertion will
be ever be made. However, if the unit itself matches an existing unit in
the table, then that (matching unit) will be returned. Otherwise, the
given unit will be returned.
- Overrides:
put
in class UnitsSI
main
public static void main(String[] args)
audit
public void audit(PrintStream stream)
- Overrides:
audit
in class UnitsTable
lookup
public Measurable lookup(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(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)
- 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).
- Returns:
- the first Measurable which was found in this table that is also parallel to units.
- See Also:
UnitsTable.findParallel(com.rubecula.jquantity.Measurable)