java.io.Serializable
public class Length
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class | Description |
---|---|---|
static class |
Length.UnitsOfLength |
Defines possible units to be used when expressing a length value
|
Modifier and Type | Field | Description |
---|---|---|
static double |
INCH_IN_MM |
Modifier and Type | Method | 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(java.lang.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
|
java.lang.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 inchespublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object