public class Length extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Length.UnitsOfLength
Defines possible units to be used when expressing a length value
|
Modifier and Type | Field and Description |
---|---|
static double |
INCH_IN_MM
1 inch is 25.4 mm.
|
Modifier and Type | Method and Description |
---|---|
double |
asInches()
Gets the value of this length, expressed in inch units
|
double |
asMillimeter()
Gets the value of this length, expressed in millimeter units
|
boolean |
equals(Object object) |
double |
getLength()
Gets the length, expressed in the original units of length.
|
Length.UnitsOfLength |
getUnitsOfLength()
Gets the original units of length.
|
int |
hashCode() |
static Length |
newCentimeterValue(double value)
Creates a new Length object with the specified value,
expressed in centimeter units
|
static Length |
newInchValue(double value)
Creates a new Length object with the specified value,
expressed in inch units
|
static Length |
newMillimeterValue(double value)
Creates a new Length object with the specified value,
expressed in millimeter units
|
String |
toString() |
public static final double INCH_IN_MM
public double getLength()
public Length.UnitsOfLength getUnitsOfLength()
public double asMillimeter()
public double asInches()
public static Length newMillimeterValue(double value)
value
- the length in millimeterspublic static Length newCentimeterValue(double value)
value
- the length in centimeterpublic static Length newInchValue(double value)
value
- the length in inches