com.ibm.icu.util

Class Measure

public abstract class Measure extends Object

An amount of a specified unit, consisting of a Number and a Unit. For example, a length measure consists of a Number and a length unit, such as feet or meters. This is an abstract class. Subclasses specify a concrete Unit type.

Measure objects are parsed and formatted by subclasses of MeasureFormat.

Measure objects are immutable.

Author: Alan Liu

See Also: java.lang.Number MeasureUnit MeasureFormat

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.

Constructor Summary
protected Measure(Number number, MeasureUnit unit)
Constructs a new object given a number and a unit.
Method Summary
booleanequals(Object obj)
Returns true if the given object is equal to this object.
NumbergetNumber()
Returns the numeric value of this object.
MeasureUnitgetUnit()
Returns the unit of this object.
inthashCode()
Returns a hashcode for this object.
StringtoString()
Returns a string representation of this object.

Constructor Detail

Measure

protected Measure(Number number, MeasureUnit unit)
Constructs a new object given a number and a unit.

Parameters: number the number unit the unit

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.

Method Detail

equals

public boolean equals(Object obj)
Returns true if the given object is equal to this object.

Returns: true if this object is equal to the given object

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.

getNumber

public Number getNumber()
Returns the numeric value of this object.

Returns: this object's Number

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.

getUnit

public MeasureUnit getUnit()
Returns the unit of this object.

Returns: this object's Unit

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.

hashCode

public int hashCode()
Returns a hashcode for this object.

Returns: a 32-bit hash

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.

toString

public String toString()
Returns a string representation of this object.

Returns: a string representation consisting of the ISO currency code together with the numeric amount

UNKNOWN: ICU 3.0 This API might change or be removed in a future release.