com.ibm.icu.util
Class Measure

java.lang.Object
  extended by com.ibm.icu.util.Measure
Direct Known Subclasses:
CurrencyAmount, TimeUnitAmount

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:
Number, MeasureUnit, MeasureFormat
Status:
Stable ICU 3.0.

Constructor Summary
protected Measure(Number number, MeasureUnit unit)
          Constructs a new object given a number and a unit.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the given object is equal to this object.
 Number getNumber()
          Returns the numeric value of this object.
 MeasureUnit getUnit()
          Returns the unit of this object.
 int hashCode()
          Returns a hashcode for this object.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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
Status:
Stable ICU 3.0.
Method Detail

equals

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

Overrides:
equals in class Object
Returns:
true if this object is equal to the given object
Status:
Stable ICU 3.0.

hashCode

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

Overrides:
hashCode in class Object
Returns:
a 32-bit hash
Status:
Stable ICU 3.0.

toString

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

Overrides:
toString in class Object
Returns:
a string representation consisting of the ISO currency code together with the numeric amount
Status:
Stable ICU 3.0.

getNumber

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

Returns:
this object's Number
Status:
Stable ICU 3.0.

getUnit

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

Returns:
this object's Unit
Status:
Stable ICU 3.0.


Copyright (c) 2011 IBM Corporation and others.