public class Measurement
extends java.lang.Object
| Constructor and Description |
|---|
Measurement(double value,
MeasurementUnit unit)
Constructs a new instance using given value and unit.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
convert(MeasurementUnit to)
Converts a current value to the given unit.
|
Measurement |
getConverted(MeasurementUnit to)
Returns a new instance of
Measurement holding the converted value. |
MeasurementUnit |
getUnit()
Returns a current unit.
|
double |
getValue()
Returns a current value.
|
public Measurement(double value,
MeasurementUnit unit)
value - a measured value.unit - a MeasurementUnit for value.public double getValue()
public MeasurementUnit getUnit()
MeasurementUnitpublic boolean convert(MeasurementUnit to)
to - a MeasurementUnit current value should be converted to.public Measurement getConverted(MeasurementUnit to)
Measurement holding the converted value.to - a MeasurementUnit current value should be converted to.Measurement.