public class Length extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CM
String constant for centimeters.
|
static String |
INCH
String constant for inches.
|
static String |
MM
String constant for millimeters.
|
static String |
POINT
String constant for points.
|
| Constructor and Description |
|---|
Length(double value,
String unit)
Creates a Length instance.
|
Length(String text)
Creates a Length instance.
|
Length(String text,
String defaultUnit)
Creates a Length instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getUnit()
Returns the unit.
|
double |
getValue()
Returns the value.
|
double |
getValueAsMillimeter()
Returns the value converted to internal units (mm).
|
protected void |
parse(String text,
String defaultUnit)
Parses a value with unit.
|
String |
toString() |
public static final String INCH
public static final String POINT
public static final String CM
public static final String MM
public Length(double value,
String unit)
value - the valueunit - the unit (ex. "cm")public Length(String text, String defaultUnit)
text - the String to parsedefaultUnit - the default unit to assumepublic Length(String text)
text - the String to parseprotected void parse(String text, String defaultUnit)
text - the String to parsedefaultUnit - the default unit to assumepublic String getUnit()
public double getValue()
public double getValueAsMillimeter()
Copyright © 2003–2023. All rights reserved.