Q - The type of the quantity measured by this unit.public final class ProductUnit<Q extends javax.measure.Quantity<Q>> extends AbstractUnit<Q>
This class represents units formed by the product of rational powers of existing physical units.
This class maintains the canonical form of this product (simplest form after factorization). For example: METRE.pow(2).divide(METRE)
returns METRE.
AbstractUnit.Equalizername, ONE, SYMBOL_TO_UNIT| Constructor and Description |
|---|
ProductUnit()
DefaultQuantityFactory constructor (used solely to create
ONE instance). |
ProductUnit(javax.measure.Unit<?> productUnit)
Copy constructor (allows for parameterization of product units).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
Map<javax.measure.Unit<?>,Integer> |
getBaseUnits() |
javax.measure.Dimension |
getDimension() |
javax.measure.UnitConverter |
getSystemConverter()
Returns the converter from this unit to its unscaled
System Unit unit. |
javax.measure.Unit<?> |
getUnit(int index)
Returns the unit element at the specified position.
|
int |
getUnitCount()
Returns the number of unit elements in this product.
|
int |
getUnitPow(int index)
Returns the power exponent of the unit element at the specified position.
|
int |
getUnitRoot(int index)
Returns the root exponent of the unit element at the specified position.
|
int |
hashCode() |
static javax.measure.Unit<?> |
ofPow(javax.measure.Unit<?> unit,
int n)
Returns the product unit corresponding to this unit raised to the specified exponent.
|
static javax.measure.Unit<?> |
ofProduct(javax.measure.Unit<?> left,
javax.measure.Unit<?> right)
Returns the product of the specified units.
|
static javax.measure.Unit<?> |
ofQuotient(javax.measure.Unit<?> left,
javax.measure.Unit<?> right)
Returns the quotient of the specified units.
|
static javax.measure.Unit<?> |
ofRoot(javax.measure.Unit<?> unit,
int n)
Returns the product unit corresponding to the specified root of the specified unit.
|
javax.measure.Unit<?> |
pow(int n)
Returns a unit equals to this unit raised to an exponent.
|
javax.measure.Unit<Q> |
toSystemUnit()
Returns the unscaled
SI unit from which this unit is derived. |
alternate, annotate, asType, compareTo, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSymbol, getSystemUnit, internalGetConverterTo, inverse, isCompatible, isEquivalentTo, isSystemUnit, multiply, multiply, multiply, parse, prefix, root, setName, setSymbol, shift, shift, toString, transformpublic ProductUnit()
ONE instance).public ProductUnit(javax.measure.Unit<?> productUnit)
productUnit - the product unit source.ClassCastException - if the specified unit is not a product unit.public static javax.measure.Unit<?> ofProduct(javax.measure.Unit<?> left, javax.measure.Unit<?> right)
left - the left unit operand.right - the right unit operand.left * rightpublic static javax.measure.Unit<?> ofQuotient(javax.measure.Unit<?> left, javax.measure.Unit<?> right)
left - the dividend unit operand.right - the divisor unit operand.dividend / divisorpublic static javax.measure.Unit<?> ofRoot(javax.measure.Unit<?> unit, int n)
unit - the unit.n - the root's order (n > 0).unit^(1/nn)ArithmeticException - if n == 0.public static javax.measure.Unit<?> ofPow(javax.measure.Unit<?> unit, int n)
unit - the unit.nn - the exponent (nn > 0).unit^npublic javax.measure.Unit<?> pow(int n)
AbstractUnitpublic int getUnitCount()
public javax.measure.Unit<?> getUnit(int index)
index - the index of the unit element to return.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= getUnitCount()).public int getUnitPow(int index)
index - the index of the unit element.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= getUnitCount()).public int getUnitRoot(int index)
index - the index of the unit element.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= getUnitCount()).public Map<javax.measure.Unit<?>,Integer> getBaseUnits()
getBaseUnits in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>getBaseUnits in class AbstractUnit<Q extends javax.measure.Quantity<Q>>public boolean equals(Object obj)
equals in class AbstractUnit<Q extends javax.measure.Quantity<Q>>public int hashCode()
hashCode in class AbstractUnit<Q extends javax.measure.Quantity<Q>>public javax.measure.Unit<Q> toSystemUnit()
AbstractUnitSI unit from which this unit is derived.
The SI unit can be be used to identify a quantity given the unit. For
example: static boolean isAngularVelocity(AbstractUnit> unit) {
return unit.toSystemUnit().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); // Returns true. toSystemUnit in class AbstractUnit<Q extends javax.measure.Quantity<Q>>public javax.measure.UnitConverter getSystemConverter()
AbstractUnitSystem Unit unit.getSystemConverter in class AbstractUnit<Q extends javax.measure.Quantity<Q>>getConverterTo(this.toSystemUnit())AbstractUnit.toSystemUnit()public javax.measure.Dimension getDimension()
getDimension in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>getDimension in class AbstractUnit<Q extends javax.measure.Quantity<Q>>Copyright © 2005–2021 Units of Measurement project. All rights reserved.