javax.measure.unit
Class CompactUnit<Q extends Quantity>

java.lang.Object
  extended by javax.measure.unit.Unit<Q>
      extended by javax.measure.unit.CompactUnit<Q>
All Implemented Interfaces:
Serializable

public class CompactUnit<Q extends Quantity>
extends Unit<Q>

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.measure.unit.Unit
ONE
 
Constructor Summary
CompactUnit()
           
 
Method Summary
 boolean equals(Object that)
          Indicates if the specified unit can be considered equals to the one specified.
 Unit<? super Q> getSystemUnit()
          Returns the base unit, alternate unit or product of base units and alternate units this unit is derived from.
 int hashCode()
          Returns the hash code for this unit.
 UnitConverter toSystemUnit()
          Returns the converter from this unit to its system unit.
 
Methods inherited from class javax.measure.unit.Unit
asType, compound, divide, divide, divide, getConverterTo, getDimension, inverse, isCompatible, 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

CompactUnit

public CompactUnit()
Method Detail

equals

public boolean equals(Object that)
Description copied from class: Unit
Indicates if the specified unit can be considered equals to the one specified.

Specified by:
equals in class Unit<Q extends Quantity>
Parameters:
that - the object to compare to.
Returns:
true if this unit is considered equal to that unit; false otherwise.

hashCode

public int hashCode()
Description copied from class: Unit
Returns the hash code for this unit.

Specified by:
hashCode in class Unit<Q extends Quantity>
Returns:
this unit hashcode value.

getSystemUnit

public Unit<? super Q> getSystemUnit()
Description copied from class: Unit
Returns the base unit, alternate unit or product of base units and alternate units this unit is derived from. The system unit identifies the "type" of quantity for which this unit is employed. For example:[code] boolean isAngularVelocity(Unit u) { return u.getSystemUnit().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); [/code]

Note: Having the same system unit is not sufficient to ensure that a converter exists between the two units (e.g. °C/m and K/m).

Specified by:
getSystemUnit in class Unit<Q extends Quantity>
Returns:
the system unit this unit is derived from.

toSystemUnit

public UnitConverter toSystemUnit()
Description copied from class: Unit
Returns the converter from this unit to its system unit.

Specified by:
toSystemUnit in class Unit<Q extends Quantity>
Returns:
this.getConverterTo(this.getSystemUnit())


Copyright © 2007 Sentilla Corporation. All Rights Reserved.