|
||||||||||
| 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.CompoundUnit<Q>
public final class CompoundUnit<Q extends Quantity>
This class represents the multi-radix units (such as "hour:min:sec").
Instances of this class are created using the Unit.compound method. Instances of this class are used mostly for
formatting purpose.
Examples of compound units:
Unit<Duration> HOUR_MINUTE_SECOND = HOUR.compound(MINUTE).compound(SECOND);
Unit<Angle> DEGREE_MINUTE_ANGLE = DEGREE_ANGLE.compound(MINUTE_ANGLE);
Unit<Length> FOOT_INCH = FOOT.compound(INCH);
| Field Summary |
|---|
| Fields inherited from class javax.measure.unit.Unit |
|---|
ONE |
| 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<Q> |
getHigh()
Returns the high unit(s) of this compound unit (can be a CompoundUnit itself). |
Unit<Q> |
getLow()
Returns the lowest unit or main unit of this compound unit (never a CompoundUnit). |
int |
hashCode()
Returns the hash code for this unit. |
Unit<Q> |
toSI()
Returns the standard unit from which this unit is derived. |
java.lang.String |
toString()
Overrides the default implementation as
compound units are not recognized by the standard UCUM format. |
| Methods inherited from class javax.measure.unit.Unit |
|---|
alternate, asType, compound, divide, divide, divide, getDimension, inverse, isCompatible, isSI, plus, pow, root, times, times, times, transform, valueOf |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Unit<Q> getLow()
CompoundUnit).
public Unit<Q> getHigh()
CompoundUnit itself).
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 java.lang.String toString()
default implementation as
compound units are not recognized by the standard UCUM format.
toString 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 | |||||||||