public abstract class DimensionalModel extends Object
This class represents the physical model used for dimensional analysis.
In principle, dimensions of physical quantities could be defined as "fundamental"
(such as momentum or energy or electric current) making such quantities
uncommensurate (not comparable). Modern physics has cast doubt on
the very existence of incompatible fundamental dimensions of physical quantities.
For example, most physicists do not recognize temperature,
Θ, as a fundamental dimension since it
essentially expresses the energy per particle per degree of freedom,
which can be expressed in terms of energy (or mass, length, and time).
To support, such model the method #getConverter may
returns a non-null value for distinct dimensions.
The default model is Standard. Applications may
use one of the predefined model or create their own.
[code]
DimensionalModel relativistic = new DimensionalModel() {
public Dimension getFundamentalDimension(QuantityDimension dimension) {
if (dimension.equals(QuantityDimension.LENGTH)) return QuantityDimension.TIME; // Consider length derived from time.
return super.getDimension(dimension); // Returns product of fundamental dimension.
}
public UnitConverter getDimensionalTransform(QuantityDimension dimension) {
if (dimension.equals(QuantityDimension.LENGTH)) return new RationalConverter(1, 299792458); // Converter (1/C) from LENGTH SI unit (m) to TIME SI unit (s).
return super.getDimensionalTransform(dimension);
}
};
LocalContext.enter();
try {
DimensionalModel.setCurrent(relativistic); // Current thread use the relativistic model.
SI.KILOGRAM.getConverterToAny(SI.JOULE); // Allowed.
...
} finally {
LocalContext.exit();
}
[/code]
| Modifier | Constructor and Description |
|---|---|
protected |
DimensionalModel()
Default constructor (allows for derivation).
|
| Modifier and Type | Method and Description |
|---|---|
static DimensionalModel |
current()
Returns the physics model used by the current thread
(by default an instance of
StandardModel). |
javax.measure.UnitConverter |
getDimensionalTransform(javax.measure.Dimension dimension)
Returns the dimensional transform of the specified dimension.
|
javax.measure.Dimension |
getFundamentalDimension(javax.measure.Dimension dimension)
Returns the fundamental dimension for the one specified.
|
protected DimensionalModel()
public static DimensionalModel current()
StandardModel).LocalContextpublic javax.measure.Dimension getFundamentalDimension(javax.measure.Dimension dimension)
dimension - the dimension for which the fundamental dimension is returned.this or a rational product of fundamental dimension.public javax.measure.UnitConverter getDimensionalTransform(javax.measure.Dimension dimension)
dimension - the dimension for which the dimensional transform is returned.Copyright © 2005–2024 Units of Measurement project. All rights reserved.