Package javax.measure.unit
Class Dimension
java.lang.Object
javax.measure.unit.Dimension
- All Implemented Interfaces:
Serializable
This class represents the dimension of an unit. Two units u1
and u2
are compatible
if and
only if (u1.getDimension().equals(u2.getDimension())))
Instances of this class are immutable.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This interface represents the mapping betweenbase units
anddimensions
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Dimension
Holds amount of substance dimension (N).static final Dimension
Holds electric current dimension (I).static final Dimension
Holds length dimension (L).static final Dimension
Holds mass dimension (M).static final Dimension
Holds dimensionless.static final Dimension
Holds temperature dimension (θ).static final Dimension
Holds time dimension (T). -
Constructor Summary
ConstructorDescriptionDimension
(char symbol) Creates a new dimension associated to the specified symbol. -
Method Summary
Modifier and TypeMethodDescriptionfinal Dimension
Returns the quotient of this dimension with the one specified.boolean
Indicates if the specified dimension is equals to the one specified.static Dimension.Model
getModel()
Returns the model used to determinate the units dimensions (defaultSTANDARD
).int
hashCode()
Returns the hash code for this dimension.final Dimension
pow
(int n) Returns this dimension raised to an exponent.final Dimension
root
(int n) Returns the given root of this dimension.static void
setModel
(Dimension.Model model) Sets the model used to determinate the units dimensions.final Dimension
Returns the product of this dimension with the one specified.toString()
Returns the representation of this dimension.
-
Field Details
-
NONE
Holds dimensionless. -
LENGTH
Holds length dimension (L). -
MASS
Holds mass dimension (M). -
TIME
Holds time dimension (T). -
ELECTRIC_CURRENT
Holds electric current dimension (I). -
TEMPERATURE
Holds temperature dimension (θ). -
AMOUNT_OF_SUBSTANCE
Holds amount of substance dimension (N).
-
-
Constructor Details
-
Dimension
public Dimension(char symbol) Creates a new dimension associated to the specified symbol.- Parameters:
symbol
- the associated symbol.
-
-
Method Details
-
times
Returns the product of this dimension with the one specified.- Parameters:
that
- the dimension multiplicand.- Returns:
this * that
-
divide
Returns the quotient of this dimension with the one specified.- Parameters:
that
- the dimension divisor.- Returns:
this / that
-
pow
Returns this dimension raised to an exponent.- Parameters:
n
- the exponent.- Returns:
- the result of raising this dimension to the exponent.
-
root
Returns the given root of this dimension.- Parameters:
n
- the root's order.- Returns:
- the result of taking the given root of this dimension.
- Throws:
ArithmeticException
- ifn == 0
.
-
toString
Returns the representation of this dimension. -
equals
Indicates if the specified dimension is equals to the one specified. -
hashCode
public int hashCode()Returns the hash code for this dimension. -
setModel
Sets the model used to determinate the units dimensions.- Parameters:
model
- the new model to be used when calculating unit dimensions.
-
getModel
Returns the model used to determinate the units dimensions (defaultSTANDARD
).- Returns:
- the model used when calculating unit dimensions.
-