Top Description Fields Constructors Methods
tech.units.indriya.spi

public abstract Class DimensionalModel

extends Object
Class Inheritance
Known Direct Subclasses
tech.units.indriya.spi.StandardModel
Imports
java.util.Map, javax.measure.Dimension, tech.units.indriya.function.AbstractConverter, tech.units.indriya.unit.UnitDimension

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. DimensionalModel relativistic = new DimensionalModel() { public Dimension getFundamentalDimension(Dimension 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(Dimension 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); } }; try { DimensionalModel.setCurrent(relativistic); // Current thread use the relativistic model. Units.KILOGRAM.getConverterToAny(Units.JOULE); // Allowed. ... } finally { cleanup(); }

Authors
Jean-Marie Dautelle, Werner Keil, Andi Huber
Since
1.0
Version
1.3, September 30, 2024
See Also
Wikipedia: Dimensional Analysis

Field Summary

Modifier and TypeField and Description
private static DimensionalModel
currentModel

Holds the current model.

Constructor Summary

AccessConstructor and Description
protected
DimensionalModel()

DimensionalModel constructor (allows for derivation).

Method Summary

Modifier and TypeMethod and Description
public static DimensionalModel

Returns:

the current dimensional model.
current
()

Returns the current model (by default an instance of StandardModel).

public AbstractConverter

Returns:

the dimensional transform (identity for fundamental dimensions).
getDimensionalTransform
(Dimension
the dimension for which the dimensional transform is returned.
dimension
)

Returns the dimensional transform of the specified dimension.

public Dimension

Returns:

this or a rational product of fundamental dimension.
getFundamentalDimension
(Dimension
the dimension for which the fundamental dimension is returned.
dimension
)

Returns the fundamental dimension for the one specified.

protected static void
setCurrent(DimensionalModel
the new current model.
model
)

Sets the current dimensional model

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentModelback to summary
private static DimensionalModel currentModel

Holds the current model.

Constructor Detail

DimensionalModelback to summary
protected DimensionalModel()

DimensionalModel constructor (allows for derivation).

Method Detail

currentback to summary
public static DimensionalModel current()

Returns the current model (by default an instance of StandardModel).

Returns:DimensionalModel

the current dimensional model.

getDimensionalTransformback to summary
public AbstractConverter getDimensionalTransform(Dimension dimension)

Returns the dimensional transform of the specified dimension. If the specified dimension is a fundamental dimension or a product of fundamental dimensions the identity converter is returned; otherwise the converter from the system unit (SI) of the specified dimension to the system unit (SI) of its fundamental dimension is returned.

Parameters
dimension:Dimension

the dimension for which the dimensional transform is returned.

Returns:AbstractConverter

the dimensional transform (identity for fundamental dimensions).

getFundamentalDimensionback to summary
public Dimension getFundamentalDimension(Dimension dimension)

Returns the fundamental dimension for the one specified. If the specified dimension is a dimensional product, the dimensional product of its fundamental dimensions is returned. Physical quantities are considered commensurate only if their fundamental dimensions are equals using the current physics model.

Parameters
dimension:Dimension

the dimension for which the fundamental dimension is returned.

Returns:Dimension

this or a rational product of fundamental dimension.

setCurrentback to summary
protected static void setCurrent(DimensionalModel model)

Sets the current dimensional model

Parameters
model:DimensionalModel

the new current model.

See Also
current