|
Java Units API Build 2004-02-06 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectUnit
BaseUnit
This class represents the building blocks on top of which all others units are created.
Base units are mutually independent; although some implementation may
support conversions between base units by allowing the dimensional
unit of a base unit to be changed
(ref. optional operation: setDimension(javax.units.Unit, javax.units.Converter)).
Examples of base units:
METER = BaseUnit.getInstance("m");
KILOGRAM = BaseUnit.getInstance("kg");
SECOND = BaseUnit.getInstance("s");
AMPERE = BaseUnit.getInstance("A");
| Field Summary |
| Fields inherited from class Unit |
ONE |
| Constructor Summary | |
protected |
BaseUnit(String symbol)
Creates a base unit with the specified symbol. |
| Method Summary | |
boolean |
equals(Object that)
Indicates if this unit is equal to the object specified. |
Unit |
getBaseUnits()
|
static BaseUnit |
getInstance(String symbol)
Returns the base unit with the specified symbol. |
String |
getSymbol()
Returns the symbol for this base unit. |
Unit |
getSystemUnit()
Returns the system unit for this unit. |
void |
setDimension(Unit unit,
Converter toDimension)
Optional operation: Sets the dimensional unit of this base unit. |
| Methods inherited from class Unit |
add, alternate, appendTo, divide, getConverterTo, getDimension, getInstance, getInstances, hashCode, isCompatible, isSystemUnit, multiply, multiply, pow, readResolve, root, searchSymbol, toString, valueOf |
| Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
protected BaseUnit(String symbol)
symbol - the symbol of this base unit.| Method Detail |
public static BaseUnit getInstance(String symbol)
symbol - the base unit symbol.
IllegalArgumentException - if the specified symbol is currently
associated to a different type of unit.public final String getSymbol()
public void setDimension(Unit unit,
Converter toDimension)
SI.METER.setDimension(SI.NANO(SI.SECOND),
new MultiplyConverter(1e9 / c));
SI.SECOND.setDimension(SI.NANO(SI.SECOND),
new MultiplyConverter(1e9));
// In this high-energy context, length and time are compatible,
// they have the same "ns" dimensional unit.
}
Note: Changing the dimensional units, makes possible conversions otherwise prohibited (e.g. conversion between meters and seconds in a relativistic context).
unit - the unit identifying the new dimension of this
base unit.toDimension - the converter to the specified dimensional unit.
UnsupportedOperationException - if this operation is not supported
by this implementation.public Unit getSystemUnit()
UnitNote: Having the same system units is not sufficient to ensure that a converter exists between the two units (e.g. °C/m and K/m).
getSystemUnit in class UnitUnit.isSystemUnit()public boolean equals(Object that)
Unit== to test for equality.
equals in class Unitthat - the object to compare for equality.
true if this unit and the specified object are
considered equal; false otherwise.public Unit getBaseUnits()
|
Java Units API Build 2004-02-06 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
Symbols, terms and definitions | JSR-108 project |