Package org.daisy.braille.tools
Class Length
java.lang.Object
org.daisy.braille.tools.Length
- All Implemented Interfaces:
Serializable
Provides a length measurement that can be expressed using the
preferred units of length.
- Author:
- Joel HÃ¥kansson
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Defines possible units to be used when expressing a length value -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
asInches()
Gets the value of this length, expressed in inch unitsdouble
Gets the value of this length, expressed in millimeter unitsboolean
double
Gets the length, expressed in the original units of length.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 unitsstatic Length
newInchValue
(double value) Creates a new Length object with the specified value, expressed in inch unitsstatic Length
newMillimeterValue
(double value) Creates a new Length object with the specified value, expressed in millimeter unitstoString()
-
Field Details
-
INCH_IN_MM
public static final double INCH_IN_MM- See Also:
-
-
Method Details
-
getLength
public double getLength()Gets the length, expressed in the original units of length.- Returns:
- returns the length
-
getUnitsOfLength
Gets the original units of length.- Returns:
- returns the original units of length
-
asMillimeter
public double asMillimeter()Gets the value of this length, expressed in millimeter units- Returns:
- returns the value
-
asInches
public double asInches()Gets the value of this length, expressed in inch units- Returns:
- returns the value
-
newMillimeterValue
Creates a new Length object with the specified value, expressed in millimeter units- Parameters:
value
- the length in millimeters- Returns:
- returns a new Length object
-
newCentimeterValue
Creates a new Length object with the specified value, expressed in centimeter units- Parameters:
value
- the length in centimeter- Returns:
- returns a new Length object
-
newInchValue
Creates a new Length object with the specified value, expressed in inch units- Parameters:
value
- the length in inches- Returns:
- returns a new Length object
-
toString
-
equals
-
hashCode
public int hashCode()
-