Package tech.units.indriya.quantity
Class QuantityDimension
java.lang.Object
tech.units.indriya.quantity.QuantityDimension
- All Implemented Interfaces:
Serializable
,javax.measure.Dimension
public final class QuantityDimension
extends Object
implements javax.measure.Dimension, Serializable
This class represents a quantity dimension (dimension of a physical quantity).
The dimension associated to any given quantity are given by the published
DimensionService
instances. For convenience, a static method
aggregating the results of all
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final javax.measure.Dimension
Holds amount of substance dimension (N).static final javax.measure.Dimension
Holds electric current dimension (I).static final javax.measure.Dimension
Holds length dimension (L).private static final Logger
static final javax.measure.Dimension
Holds luminous intensity dimension (J).static final javax.measure.Dimension
Holds mass dimension (M).static final javax.measure.Dimension
Holds dimensionless.private final javax.measure.Unit<?>
Holds the pseudo unit associated to this dimension.private static final long
static final javax.measure.Dimension
Holds temperature dimension (Θ).static final javax.measure.Dimension
Holds time dimension (T). -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
QuantityDimension
(char symbol) Returns the physical dimension having the specified symbol.private
QuantityDimension
(javax.measure.Unit<?> pseudoUnit) Constructor from pseudo-unit (not visible). -
Method Summary
Modifier and TypeMethodDescriptionjavax.measure.Dimension
divide
(javax.measure.Dimension that) Returns the quotient of this dimension with the one specified.divide
(QuantityDimension that) Returns the quotient of this dimension with the one specified.boolean
Returns the fundamental (base) dimensions and their exponent whose product is this dimension ornull
if this dimension is a fundamental dimension.int
hashCode()
javax.measure.Dimension
multiply
(javax.measure.Dimension that) Returns the product of this dimension with the one specified.multiply
(QuantityDimension that) Returns the product of this dimension with the one specified.static <Q extends javax.measure.Quantity<Q>>
javax.measure.DimensionReturns the dimension for the specified quantity type by aggregating the results ofDimensionService
ornull
if the specified quantity is unknown.static javax.measure.Dimension
parse
(char symbol) Returns the dimension for the specified symbol.final QuantityDimension
pow
(int n) Returns this dimension raised to an exponent.final QuantityDimension
root
(int n) Returns the given root of this dimension.toString()
-
Field Details
-
logger
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
NONE
public static final javax.measure.Dimension NONEHolds dimensionless.- Since:
- 1.0
-
LENGTH
public static final javax.measure.Dimension LENGTHHolds length dimension (L).- Since:
- 1.0
-
MASS
public static final javax.measure.Dimension MASSHolds mass dimension (M).- Since:
- 1.0
-
TIME
public static final javax.measure.Dimension TIMEHolds time dimension (T).- Since:
- 1.0
-
ELECTRIC_CURRENT
public static final javax.measure.Dimension ELECTRIC_CURRENTHolds electric current dimension (I).- Since:
- 1.0
-
TEMPERATURE
public static final javax.measure.Dimension TEMPERATUREHolds temperature dimension (Θ).- Since:
- 1.0
-
AMOUNT_OF_SUBSTANCE
public static final javax.measure.Dimension AMOUNT_OF_SUBSTANCEHolds amount of substance dimension (N).- Since:
- 1.0
-
LUMINOUS_INTENSITY
public static final javax.measure.Dimension LUMINOUS_INTENSITYHolds luminous intensity dimension (J). -
pseudoUnit
private final javax.measure.Unit<?> pseudoUnitHolds the pseudo unit associated to this dimension.
-
-
Constructor Details
-
QuantityDimension
QuantityDimension(char symbol) Returns the physical dimension having the specified symbol.- Parameters:
symbol
- the associated symbol.
-
QuantityDimension
private QuantityDimension(javax.measure.Unit<?> pseudoUnit) Constructor from pseudo-unit (not visible).- Parameters:
pseudoUnit
- the pseudo-unit.
-
-
Method Details
-
of
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Dimension of(Class<Q> quantityType) Returns the dimension for the specified quantity type by aggregating the results ofDimensionService
ornull
if the specified quantity is unknown.- Parameters:
quantityType
- the quantity type.- Returns:
- the dimension for the quantity type or
null
. - Since:
- 1.1
-
parse
public static javax.measure.Dimension parse(char symbol) Returns the dimension for the specified symbol.- Parameters:
sambol
- the quantity symbol.- Returns:
- the dimension for the given symbol.
- Since:
- 1.0.1
-
multiply
public javax.measure.Dimension multiply(javax.measure.Dimension that) Returns the product of this dimension with the one specified. If the specified dimension is not a physics dimension, thenthat.multiply(this)
is returned.- Specified by:
multiply
in interfacejavax.measure.Dimension
- Parameters:
that
- the dimension multiplicand.- Returns:
this * that
- Since:
- 1.0
-
multiply
Returns the product of this dimension with the one specified.- Parameters:
that
- the dimension multiplicand.- Returns:
this * that
- Since:
- 1.0
-
divide
public javax.measure.Dimension divide(javax.measure.Dimension that) Returns the quotient of this dimension with the one specified.- Specified by:
divide
in interfacejavax.measure.Dimension
- Parameters:
that
- the dimension divisor.- Returns:
this.multiply(that.pow(-1))
- Since:
- 1.0
-
divide
Returns the quotient of this dimension with the one specified.- Parameters:
that
- the dimension divisor.- Returns:
this.multiply(that.pow(-1))
- Since:
- 1.0
-
pow
Returns this dimension raised to an exponent.- Specified by:
pow
in interfacejavax.measure.Dimension
- Parameters:
n
- the exponent.- Returns:
- the result of raising this dimension to the exponent.
- Since:
- 1.0
-
root
Returns the given root of this dimension.- Specified by:
root
in interfacejavax.measure.Dimension
- Parameters:
n
- the root's order.- Returns:
- the result of taking the given root of this dimension.
- Throws:
ArithmeticException
- ifn == 0
.- Since:
- 1.0
-
getBaseDimensions
Returns the fundamental (base) dimensions and their exponent whose product is this dimension ornull
if this dimension is a fundamental dimension.- Specified by:
getBaseDimensions
in interfacejavax.measure.Dimension
- Returns:
- the mapping between the base dimensions and their exponent.
- Since:
- 1.0
-
toString
-
equals
-
hashCode
public int hashCode()
-