Package com.ibm.icu.util
Class Measure
java.lang.Object
com.ibm.icu.util.Measure
- Direct Known Subclasses:
CurrencyAmount
,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.)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMeasure
(Number number, MeasureUnit unit) Constructs a new object given a number and a unit. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the given object is equal to this object.Returns the numeric value of this object.getUnit()
Returns the unit of this object.int
hashCode()
Returns a hashcode for this object.private static boolean
numbersEqual
(Number a, Number b) toString()
Returns a string representation of this object.
-
Field Details
-
number
-
unit
-
-
Constructor Details
-
Measure
Constructs a new object given a number and a unit.- Parameters:
number
- the numberunit
- the unit
-
-
Method Details
-
equals
Returns true if the given object is equal to this object. -
numbersEqual
-
hashCode
public int hashCode()Returns a hashcode for this object. -
toString
Returns a string representation of this object. -
getNumber
Returns the numeric value of this object.- Returns:
- this object's Number
-
getUnit
Returns the unit of this object.- Returns:
- this object's Unit
-