org.unitsofmeasurement.unit
Interface Dimension


public interface Dimension

Dependence of a unit on the base units of a system of units. The dependency is expresses as a product of powers of dimensions corresponding to the base units, omitting any numerical factor.

Concrete dimensions are obtained through the Unit.getDimension() method. Two units u1 and u2 are compatible if and only if u1.getDimension().equals(u2.getDimension()).

Since:
0.6.0
Author:
Jean-Marie Dautelle, Werner Keil
See Also:
Wikipedia: Dimensional Analysis

Method Summary
 Dimension divide(Dimension that)
          Returns the quotient of this dimension with the one specified.
 boolean equals(Object object)
          Returns true if the given object is also a dimension, and both dimensions have equal product of powers of base dimensions.
 Map<? extends Dimension,Integer> getProductDimensions()
          Returns the base dimensions and their exponent whose product is this dimension.
 Dimension multiply(Dimension that)
          Returns the product of this dimension with the one specified.
 Dimension pow(int n)
          Returns this dimension raised to an exponent.
 Dimension root(int n)
          Returns the given root of this dimension.
 

Method Detail

multiply

Dimension multiply(Dimension that)
Returns the product of this dimension with the one specified.

Parameters:
that - the dimension multiplicand.
Returns:
this * that

divide

Dimension divide(Dimension that)
Returns the quotient of this dimension with the one specified.

Parameters:
that - the dimension divisor.
Returns:
this / that

pow

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

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 - if n == 0.

getProductDimensions

Map<? extends Dimension,Integer> getProductDimensions()
Returns the base dimensions and their exponent whose product is this dimension. Bases dimensions are dimensions corresponding to base units in the system of units in use. The exponent of any dimension not included in the map is assumed to be zero.

Special cases, ignoring all dimensions associated to power 0 (if any):

Returns:
the mapping between the base dimensions and their exponent (never null).
See Also:
Unit.getProductUnits()

equals

boolean equals(Object object)
Returns true if the given object is also a dimension, and both dimensions have equal product of powers of base dimensions.

Implementations shall take special care against infinite recursivity if this Dimension instance is itself contained in the set of keys.

Overrides:
equals in class Object
Parameters:
object - the other object to compare with this dimension, or null.
Returns:
true if the other object is also a dimension, and both dimensions have equal product of powers.


Copyright © 2005-2013 Units of Measurement project. All Rights Reserved.