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
.
name, 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() |
static javax.measure.Unit<?> |
getProductInstance(javax.measure.Unit<?> left,
javax.measure.Unit<?> right)
Returns the product of the specified units.
|
static javax.measure.Unit<?> |
getQuotientInstance(javax.measure.Unit<?> left,
javax.measure.Unit<?> right)
Returns the quotient of the specified units.
|
static javax.measure.Unit<?> |
getRootInstance(AbstractUnit<?> unit,
int n)
Returns the product unit corresponding to the specified root of the specified unit.
|
String |
getSymbol() |
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() |
AbstractUnit<Q> |
toSystemUnit()
Returns the unscaled
SI unit from which this unit is derived. |
alternate, annotate, asType, compareTo, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSystemUnit, inverse, isCompatible, isSystemUnit, multiply, multiply, multiply, parse, pow, root, setName, setSymbol, shift, toString, transform
public 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<?> getProductInstance(javax.measure.Unit<?> left, javax.measure.Unit<?> right)
left
- the left unit operand.right
- the right unit operand.left * right
public static javax.measure.Unit<?> getQuotientInstance(javax.measure.Unit<?> left, javax.measure.Unit<?> right)
left
- the dividend unit operand.right
- the divisor unit operand.dividend / divisor
public static javax.measure.Unit<?> getRootInstance(AbstractUnit<?> unit, int n)
unit
- the unit.n
- the root's order (n > 0).unit^(1/nn)
ArithmeticException
- if n == 0
.public 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 AbstractUnit<Q> toSystemUnit()
AbstractUnit
SI
unit from which this unit is derived.
They SI unit can be be used to identify a quantity given the unit. For example:[code] static boolean isAngularVelocity(AbstractUnit> unit) {
return unit.toSI().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); // Returns true. [/code]toSystemUnit
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public javax.measure.UnitConverter getSystemConverter()
AbstractUnit
System Unit
unit.getSystemConverter
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
getConverterTo(this.toSystemUnit())
#toSI
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.