|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.measure.unit.Unit<Q>
javax.measure.unit.DerivedUnit<Q>
javax.measure.unit.ProductUnit<Q>
public final class ProductUnit<Q extends Quantity>
This class represents units formed by the product of rational powers of existing units.
This class maintains the canonical form of this product (simplest form
after factorization). For example: METRE.pow(2).divide(METRE)
returns METRE.
Unit.times(Unit),
Unit.divide(Unit),
Unit.pow(int),
Unit.root(int),
Serialized Form| Field Summary |
|---|
| Fields inherited from class javax.measure.unit.Unit |
|---|
ONE |
| Constructor Summary | |
|---|---|
ProductUnit(Unit<?> productUnit)
Copy constructor (allows for parameterization of product units). |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object that)
Indicates if the specified unit can be considered equals to the one specified. |
UnitConverter |
getConverterTo(Unit<Q> unit)
Returns a converter of numeric values from this unit to another unit. |
Unit<? extends Quantity> |
getUnit(int index)
Returns the unit at the specified position. |
int |
getUnitCount()
Returns the number of units in this product. |
int |
getUnitPow(int index)
Returns the power exponent of the unit at the specified position. |
int |
getUnitRoot(int index)
Returns the root exponent of the unit at the specified position. |
int |
hashCode()
Returns the hash code for this unit. |
Unit<Q> |
toSI()
Returns the standard unit from which this unit is derived. |
| Methods inherited from class javax.measure.unit.Unit |
|---|
alternate, asType, compound, divide, divide, divide, getDimension, inverse, isCompatible, isSI, plus, pow, root, times, times, times, toString, transform, valueOf |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ProductUnit(Unit<?> productUnit)
productUnit - the product unit source.
java.lang.ClassCastException - if the specified unit is not a product unit.| Method Detail |
|---|
public int getUnitCount()
public Unit<? extends Quantity> getUnit(int index)
index - the index of the unit to return.
java.lang.IndexOutOfBoundsException - if index is out of range
(index < 0 || index >= size()).public int getUnitPow(int index)
index - the index of the unit to return.
java.lang.IndexOutOfBoundsException - if index is out of range
(index < 0 || index >= size()).public int getUnitRoot(int index)
index - the index of the unit to return.
java.lang.IndexOutOfBoundsException - if index is out of range
(index < 0 || index >= size()).public boolean equals(java.lang.Object that)
Unit
equals in class Unit<Q extends Quantity>that - the object to compare to.
true if this unit is considered equal to that unit;
false otherwise.public int hashCode()
Unit
hashCode in class Unit<Q extends Quantity>public Unit<Q> toSI()
Unitquantity
for which this unit is employed. For example:
boolean isAngularVelocity(Unit<?> u) {
return u.toSI().equals(RADIAN.divide(SECOND));
}
assert(REVOLUTION.divide(MINUTE).isAngularVelocity());
Note: Having the same SI unit is not sufficient to ensure that a converter exists between the two units (e.g. °C/m and K/m).
toSI in class Unit<Q extends Quantity>public final UnitConverter getConverterTo(Unit<Q> unit)
Unitstandard unit.
getConverterTo in class Unit<Q extends Quantity>unit - the unit to which to convert the numeric values.
that unit.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||