Package org.krysalis.barcode4j.tools
Class Length
java.lang.Object
org.krysalis.barcode4j.tools.Length
This class represents a length (value plus unit). It is used to parse
expressions like "0.21mm".
- Version:
- $Id: Length.java,v 1.3 2008-05-13 13:00:46 jmaerki Exp $
- Author:
- Jeremias Maerki
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
INCH
String constant for inches.- See Also:
-
POINT
String constant for points.- See Also:
-
CM
String constant for centimeters.- See Also:
-
MM
String constant for millimeters.- See Also:
-
-
Constructor Details
-
Length
Creates a Length instance.- Parameters:
value- the valueunit- the unit (ex. "cm")
-
Length
Creates a Length instance.- Parameters:
text- the String to parsedefaultUnit- the default unit to assume
-
Length
Creates a Length instance. The default unit assumed is "mm".- Parameters:
text- the String to parse
-
-
Method Details
-
parse
Parses a value with unit.- Parameters:
text- the String to parsedefaultUnit- the default unit to assume
-
getUnit
Returns the unit.- Returns:
- String
-
getValue
public double getValue()Returns the value.- Returns:
- double
-
getValueAsMillimeter
public double getValueAsMillimeter()Returns the value converted to internal units (mm).- Returns:
- the value (in mm)
-
toString
-