public class Measure extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Measure>
| Constructor and Description |
|---|
Measure(double measureValue,
Unit unitOfMeasure)
Instantiates a new measurement
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Measure other)
Return if the object is greater than, less than, or equal to this
measurement.
|
Measure |
convertTo(Unit otherUnit)
Convert to another compatible unit of measure.
|
java.lang.String |
getMeasureType()
Gets the measure type.
|
Unit |
getUnit()
Gets the unit.
|
double |
getValue()
Gets the value.
|
boolean |
isEqualTo(Measure other)
Checks this measure is equal to another measure.
|
static Measure |
parse(java.lang.String str,
java.lang.String type)
Parses a string specifying measurement.
|
java.lang.String |
toString()
Convert the measurement to a string representation
|
public Measure(double measureValue,
Unit unitOfMeasure)
measureValue - the value of the measureunitOfMeasure - the units used in the measurementpublic int compareTo(Measure other)
compareTo in interface java.lang.Comparable<Measure>other - the other measure to be comparedpublic Measure convertTo(Unit otherUnit)
otherUnit - the other unit of measurepublic java.lang.String getMeasureType()
public Unit getUnit()
public double getValue()
public boolean isEqualTo(Measure other)
other - the other measurementpublic java.lang.String toString()
toString in class java.lang.Objectpublic static Measure parse(java.lang.String str, java.lang.String type) throws java.text.ParseException
str - the string to parsetype - the measurement typejava.text.ParseException - if there is an error parsing the measurement
string.