javax.measure.unit
public final class Dimension extends java.lang.Object implements java.io.Serializable
u1 and u2 are
compatible if and only if (u1.getDimension().equals(u2.getDimension())))
Instances of this class are immutable.| Modifier and Type | Class and Description |
|---|---|
static interface |
Dimension.Model
This interface represents the mapping between
base units and dimensions. |
| Modifier and Type | Field and Description |
|---|---|
static Dimension |
AMOUNT_OF_SUBSTANCE
Holds amount of substance dimension (N).
|
static Dimension |
ELECTRIC_CURRENT
Holds electric current dimension (I).
|
static Dimension |
LENGTH
Holds length dimension (L).
|
static Dimension |
MASS
Holds mass dimension (M).
|
static Dimension |
NONE
Holds dimensionless.
|
static Dimension |
TEMPERATURE
Holds temperature dimension (θ).
|
static Dimension |
TIME
Holds time dimension (T).
|
| Constructor and Description |
|---|
Dimension(char symbol)
Creates a new dimension associated to the specified symbol.
|
| Modifier and Type | Method and Description |
|---|---|
Dimension |
divide(Dimension that)
Returns the quotient of this dimension with the one specified.
|
boolean |
equals(java.lang.Object that)
Indicates if the specified dimension is equals to the one specified.
|
static Dimension.Model |
getModel()
Returns the model used to determinate the units dimensions (default
STANDARD). |
int |
hashCode()
Returns the hash code for this dimension.
|
Dimension |
pow(int n)
Returns this dimension raised to an exponent.
|
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.
|
Dimension |
times(Dimension that)
Returns the product of this dimension with the one specified.
|
java.lang.String |
toString()
Returns the representation of this dimension.
|
public static final Dimension NONE
public static final Dimension LENGTH
public static final Dimension MASS
public static final Dimension TIME
public static final Dimension ELECTRIC_CURRENT
public static final Dimension TEMPERATURE
public static final Dimension AMOUNT_OF_SUBSTANCE
public Dimension(char symbol)
symbol - the associated symbol.public Dimension times(Dimension that)
that - the dimension multiplicand.this * thatpublic Dimension divide(Dimension that)
that - the dimension divisor.this / thatpublic Dimension pow(int n)
n - the exponent.public Dimension root(int n)
n - the root's order.java.lang.ArithmeticException - if n == 0.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object that)
equals in class java.lang.Objectthat - the object to compare to.true if this dimension is equals to that dimension; false otherwise.public int hashCode()
hashCode in class java.lang.Objectpublic static void setModel(Dimension.Model model)
model - the new model to be used when calculating unit dimensions.public static Dimension.Model getModel()
STANDARD).