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
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines possible units to be used when expressing a length value -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondoubleasInches()Gets the value of this length, expressed in inch unitsdoubleGets the value of this length, expressed in millimeter unitsbooleandoubleGets the length, expressed in the original units of length.Gets the original units of length.inthashCode()static LengthnewCentimeterValue(double value) Creates a new Length object with the specified value, expressed in centimeter unitsstatic LengthnewInchValue(double value) Creates a new Length object with the specified value, expressed in inch unitsstatic LengthnewMillimeterValue(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()
-