Modifier and Type | Field and Description |
---|---|
static double |
FEET_PER_METER |
static Distance |
INVALID
Convenience value representing an invalid/impossible distance, arbitrarily chosen to be negative one meter.
|
static Distance |
ZERO
Convenience value for zero meters.
|
Modifier and Type | Method and Description |
---|---|
double |
feet()
Returns the value of this distance in feet.
|
static Distance |
feet(double feet)
Creates a new value in feet.
|
protected double |
getRawValue()
Subclasses must implement this to return their raw
double value. |
boolean |
isValid()
Returns
true if meters() is >= 0. |
double |
meters()
Returns the value of this distance in meters.
|
static Distance |
meters(double meters)
Creates a new value in meters.
|
protected Unit<Distance> |
newInstance(double rawValue)
Subclasses must override this so that arithmetic "operators" can create new instances.
|
String |
toString() |
public static final double FEET_PER_METER
public static final Distance ZERO
public static final Distance INVALID
public double meters()
public double feet()
public static Distance meters(double meters)
public static Distance feet(double feet)
public boolean isValid()
true
if meters()
is >= 0.protected double getRawValue()
Unit
double
value.getRawValue
in class Unit<Distance>