|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.moml.unit.UnitLibrary
public class UnitLibrary
A Library containing definitions of commonly used units. Currently, the Unit library is static in the sense that it is loaded when the system starts and is hard-wired to a particular Unit System (the System International Unit System). However, it should be easy to change the architecture so that multiple Unit Systems can be accommodated, and loaded on-the-fly.
Red (rowland) |
Red (rowland) |
Nested Class Summary | |
---|---|
private class |
UnitLibrary.UnitNameExprPair
UnitNameExprPair |
Field Summary | |
---|---|
private static boolean |
_debug
|
private static int |
_numCats
|
private static UParser |
_parser
|
private static java.util.Vector |
_unitsLibrary
|
static Unit |
Identity
The Identity Unit, i.e. 1.0*<0, 0, ..., 0> |
Constructor Summary | |
---|---|
UnitLibrary()
|
Method Summary | |
---|---|
static void |
addToLibrary(Unit unit)
Add a unit to the Library. |
static Unit |
getBaseUnit(int catNum)
Find the Unit in the library that is basic (scale equal to 1), singular (all but one dimensions equal to 0). |
static Unit |
getClosestUnit(Unit unit)
Search Library to find Unit that has the same type and is the closest to a unit in terms of the scalars. |
static java.util.Vector |
getLibrary()
Return the Library. |
static int |
getNumCategories()
Return the number of categories. |
static UParser |
getParser()
Return the Parser. |
static Unit |
getUnit(Unit unit)
Search Library for Unit equal to a particular unit. |
static Unit |
getUnitByName(java.lang.String name)
Search the Library for a unit with a particular name. |
static java.util.Vector |
getUnitsByType(Unit unit)
Search Library for all Units with type equal to this one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Unit Identity
private static boolean _debug
private static int _numCats
private static UParser _parser
private static java.util.Vector _unitsLibrary
Constructor Detail |
---|
public UnitLibrary()
Method Detail |
---|
public static void addToLibrary(Unit unit)
unit
- Unit to add to the library.public static Unit getBaseUnit(int catNum)
catNum
- The category number.
public static Unit getClosestUnit(Unit unit)
unit
- The unit for which to search.
public static java.util.Vector getLibrary()
public static int getNumCategories()
public static UParser getParser()
public static Unit getUnit(Unit unit)
unit
- The unit to search for.
public static Unit getUnitByName(java.lang.String name)
name
- The name of the desired unit.
public static java.util.Vector getUnitsByType(Unit unit)
unit
- The unit to search for.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |