Package javax.measure.unit
Class Dimension
- java.lang.Object
-
- javax.measure.unit.Dimension
-
- All Implemented Interfaces:
Serializable
public final class Dimension extends Object implements Serializable
This class represents the dimension of an unit. Two units
u1andu2arecompatibleif and only if(u1.getDimension().equals(u2.getDimension())))Instances of this class are immutable.
- See Also:
- Wikipedia: Dimensional Analysis, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDimension.ModelThis interface represents the mapping betweenbase unitsanddimensions.
-
Field Summary
Fields Modifier and Type Field Description static DimensionAMOUNT_OF_SUBSTANCEHolds amount of substance dimension (N).static DimensionELECTRIC_CURRENTHolds electric current dimension (I).static DimensionLENGTHHolds length dimension (L).static DimensionMASSHolds mass dimension (M).static DimensionNONEHolds dimensionless.static DimensionTEMPERATUREHolds temperature dimension (θ).static DimensionTIMEHolds time dimension (T).
-
Constructor Summary
Constructors Constructor Description Dimension(char symbol)Creates a new dimension associated to the specified symbol.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Dimensiondivide(Dimension that)Returns the quotient of this dimension with the one specified.booleanequals(Object that)Indicates if the specified dimension is equals to the one specified.static Dimension.ModelgetModel()Returns the model used to determinate the units dimensions (defaultSTANDARD).inthashCode()Returns the hash code for this dimension.Dimensionpow(int n)Returns this dimension raised to an exponent.Dimensionroot(int n)Returns the given root of this dimension.static voidsetModel(Dimension.Model model)Sets the model used to determinate the units dimensions.Dimensiontimes(Dimension that)Returns the product of this dimension with the one specified.StringtoString()Returns the representation of this dimension.
-
-
-
Field Detail
-
NONE
public static final Dimension NONE
Holds dimensionless.
-
LENGTH
public static final Dimension LENGTH
Holds length dimension (L).
-
MASS
public static final Dimension MASS
Holds mass dimension (M).
-
TIME
public static final Dimension TIME
Holds time dimension (T).
-
ELECTRIC_CURRENT
public static final Dimension ELECTRIC_CURRENT
Holds electric current dimension (I).
-
TEMPERATURE
public static final Dimension TEMPERATURE
Holds temperature dimension (θ).
-
AMOUNT_OF_SUBSTANCE
public static final Dimension AMOUNT_OF_SUBSTANCE
Holds amount of substance dimension (N).
-
-
Method Detail
-
times
public final Dimension times(Dimension that)
Returns the product of this dimension with the one specified.- Parameters:
that- the dimension multiplicand.- Returns:
this * that
-
divide
public final Dimension divide(Dimension that)
Returns the quotient of this dimension with the one specified.- Parameters:
that- the dimension divisor.- Returns:
this / that
-
pow
public final Dimension pow(int n)
Returns this dimension raised to an exponent.- Parameters:
n- the exponent.- Returns:
- the result of raising this dimension to the exponent.
-
root
public final Dimension root(int n)
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
public String toString()
Returns the representation of this dimension.
-
equals
public boolean equals(Object that)
Indicates if the specified dimension is equals to the one specified.
-
hashCode
public int hashCode()
Returns the hash code for this dimension.
-
setModel
public static void setModel(Dimension.Model model)
Sets the model used to determinate the units dimensions.- Parameters:
model- the new model to be used when calculating unit dimensions.
-
getModel
public static Dimension.Model getModel()
Returns the model used to determinate the units dimensions (defaultSTANDARD).- Returns:
- the model used when calculating unit dimensions.
-
-