|
JScience v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.physics.units.Unit<Q>
org.jscience.physics.units.BaseUnit<Q>
public class BaseUnit<Q extends Quantity>
This class represents the building blocks on top of which all others units are created.
Base units are typically mutually independent. Although, in specialized
context (e.g. relativistic context), conversions between base units
is possible (Ref. setDimension(org.jscience.physics.units.Dimension, org.jscience.physics.units.Converter)).
Examples of base units:
METER = new BaseUnit<Length>("m", Dimension.LENGTH, Converter.IDENTITY);
KILOGRAM = new BaseUnit<Mass>("kg", Dimension.MASS, Converter.IDENTITY);
SECOND = new BaseUnit<Duration>("s", Dimension.TIME, Converter.IDENTITY);
| Field Summary |
|---|
| Fields inherited from class org.jscience.physics.units.Unit |
|---|
ONE |
| Constructor Summary | |
|---|---|
BaseUnit(java.lang.String symbol,
Dimension dimension,
Converter transform)
Creates a new base unit having the specified symbol. |
|
| Method Summary | |
|---|---|
protected boolean |
equalsImpl(java.lang.Object that)
Indicates if the specified unit can be considered equals to the one specified (for unicity purpose). |
protected Unit<Q> |
getParentUnitImpl()
Returns the parent units this unit is derived from. |
java.lang.String |
getSymbol()
Returns the symbol for this base unit. |
protected int |
hashCodeImpl()
Returns the hash code for this unit (calculated only once as units are unique). |
void |
setDimension(Dimension dimension,
Converter transform)
Sets the local dimension of
this base unit. |
protected Converter |
toParentUnitImpl()
Returns the converter to the parent unit. |
| Methods inherited from class org.jscience.physics.units.Unit |
|---|
alias, alternate, compound, divide, equals, getBaseUnits, getConverterTo, getDimension, getInstance, getInstances, getParentUnit, hashCode, inverse, isCompatible, label, plus, pow, readResolve, root, times, times, toBaseUnits, toParentUnit, toString, toText, transform, valueOf |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BaseUnit(java.lang.String symbol,
Dimension dimension,
Converter transform)
symbol - the symbol of this base unit.dimension - the default dimension for this unit.transform - the default intrinsic dimensional transform.
java.lang.IllegalArgumentException - if the specified symbol is already
used.| Method Detail |
|---|
public final java.lang.String getSymbol()
public void setDimension(Dimension dimension,
Converter transform)
local dimension of
this base unit. For example:
LocalContext.enter(); // Ensures that setting is local to current thread.
try {
SI.METER.setDimension(TIME, new MultiplyConverter(1e9 / c));
// In this high-energy context, length and time are compatible,
// they have the same "ns" dimensional unit.
} finally {
LocalContext.exit();
}
dimension - the unit identifying the new dimension of this
base unit.transform - the dimensional intrinsic transform for this
base unit (typically a multiply converter).protected boolean equalsImpl(java.lang.Object that)
Unit
equalsImpl in class Unit<Q extends Quantity>true if this unit is considered equal to
that unit; false otherwise.protected int hashCodeImpl()
Unit
hashCodeImpl in class Unit<Q extends Quantity>protected Unit<Q> getParentUnitImpl()
Unit
getParentUnitImpl in class Unit<Q extends Quantity>this if this unit is
a base unit or a product of base units.protected Converter toParentUnitImpl()
Unit
toParentUnitImpl in class Unit<Q extends Quantity>Unit.getParentUnitImpl()
|
JScience v2.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||