Top Description Fields Constructors Methods
com.ibm.icu.util

public Class Measure

extends Object
Class Inheritance
Known Direct Subclasses
com.ibm.icu.util.CurrencyAmount, com.ibm.icu.util.TimeUnitAmount

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.

Measure objects are parsed and formatted by subclasses of MeasureFormat.

Measure objects are immutable. All subclasses must guarantee that. (However, subclassing is discouraged.)

Author
Alan Liu
ICU Status
Stable since ICU 3.0.
See Also
java.lang.Number, com.ibm.icu.util.MeasureUnit, com.ibm.icu.text.MeasureFormat

Field Summary

Modifier and TypeField and Description
private final Number
private final MeasureUnit

Constructor Summary

AccessConstructor and Description
public
Measure(Number
the number
number
,
MeasureUnit
the unit
unit
)

Constructs a new object given a number and a unit.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this object is equal to the given object
equals
(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Returns true if the given object is equal to this object.
public Number

Returns:

this object's Number
getNumber
()

Returns the numeric value of this object.

public MeasureUnit

Returns:

this object's Unit
getUnit
()

Returns the unit of this object.

public int

Returns:

a 32-bit hash
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this object.
private static boolean
public String

Returns:

a string representation consisting of the ISO currency code together with the numeric amount
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of this object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

numberback to summary
private final Number number
unitback to summary
private final MeasureUnit unit

Constructor Detail

Measureback to summary
public Measure(Number number, MeasureUnit unit)

Constructs a new object given a number and a unit.

Parameters
number:Number

the number

unit:MeasureUnit

the unit

ICU Status
Stable since ICU 3.0.

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

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

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

true if this object is equal to the given object

Annotations
@Override
ICU Status
Stable since ICU 3.0.
getNumberback to summary
public Number getNumber()

Returns the numeric value of this object.

Returns:Number

this object's Number

ICU Status
Stable since ICU 3.0.
getUnitback to summary
public MeasureUnit getUnit()

Returns the unit of this object.

Returns:MeasureUnit

this object's Unit

ICU Status
Stable since ICU 3.0.
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this object.

Returns:int

a 32-bit hash

Annotations
@Override
ICU Status
Stable since ICU 3.0.
numbersEqualback to summary
private static boolean numbersEqual(Number a, Number b)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this object.

Returns:String

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

Annotations
@Override
ICU Status
Stable since ICU 3.0.