public class Measure
extends java.lang.Object
Measure objects are parsed and formatted by subclasses of MeasureFormat.
Measure objects are immutable. All subclasses must guarantee that. (However, subclassing is discouraged.)
Number
,
MeasureUnit
,
MeasureFormat
Constructor and Description |
---|
Measure(java.lang.Number number,
MeasureUnit unit)
Constructs a new object given a number and a unit.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Returns true if the given object is equal to this object.
|
java.lang.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.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
public Measure(java.lang.Number number, MeasureUnit unit)
number
- the numberunit
- the unitpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Number getNumber()
public MeasureUnit getUnit()
Copyright (c) 2016 IBM Corporation and others.