|
barcode4j 2.1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.krysalis.barcode4j.tools.Length
public class Length
This class represents a length (value plus unit). It is used to parse expressions like "0.21mm".
Field Summary | |
---|---|
static java.lang.String |
CM
String constant for centimeters. |
static java.lang.String |
INCH
String constant for inches. |
static java.lang.String |
MM
String constant for millimeters. |
static java.lang.String |
POINT
String constant for points. |
Constructor Summary | |
---|---|
Length(double value,
java.lang.String unit)
Creates a Length instance. |
|
Length(java.lang.String text)
Creates a Length instance. |
|
Length(java.lang.String text,
java.lang.String defaultUnit)
Creates a Length instance. |
Method Summary | |
---|---|
java.lang.String |
getUnit()
Returns the unit. |
double |
getValue()
Returns the value. |
double |
getValueAsMillimeter()
Returns the value converted to internal units (mm). |
protected void |
parse(java.lang.String text,
java.lang.String defaultUnit)
Parses a value with unit. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String INCH
public static final java.lang.String POINT
public static final java.lang.String CM
public static final java.lang.String MM
Constructor Detail |
---|
public Length(double value, java.lang.String unit)
value
- the valueunit
- the unit (ex. "cm")public Length(java.lang.String text, java.lang.String defaultUnit)
text
- the String to parsedefaultUnit
- the default unit to assumepublic Length(java.lang.String text)
text
- the String to parseMethod Detail |
---|
protected void parse(java.lang.String text, java.lang.String defaultUnit)
text
- the String to parsedefaultUnit
- the default unit to assumepublic java.lang.String getUnit()
public double getValue()
public double getValueAsMillimeter()
public java.lang.String toString()
toString
in class java.lang.Object
|
barcode4j 2.1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |