public class UnitParser extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
UNIT_CM |
static String |
UNIT_IN |
static String |
UNIT_MM |
static String |
UNIT_PT |
| Constructor and Description |
|---|
UnitParser() |
| Modifier and Type | Method and Description |
|---|---|
void |
addUnitKey(String key) |
void |
convertUnits(KElement element) |
String |
extractUnits(String val)
extract units if and only if the string has a pattern of "<##>mm" or "<##>cm"or "<##>in" whitespace characters may be placed between the numbers and the units
the unit case is ignored
|
String |
extractUnits(String key,
String val) |
double |
getFactor(String unit)
get the factor for one of the units to points
|
int |
getPrecision()
Getter for precision attribute.
|
boolean |
isUnit(String key) |
void |
setPrecision(int precision)
Setter for precision attribute.
|
String |
toString() |
public static final String UNIT_IN
public static final String UNIT_CM
public static final String UNIT_MM
public static final String UNIT_PT
public void convertUnits(KElement element)
element - public boolean isUnit(String key)
key - public void addUnitKey(String key)
key - public double getFactor(String unit)
unit - public String extractUnits(String key, String val)
key - the attribute name to checkval - public String extractUnits(String val)
val - the string to convertpublic void setPrecision(int precision)
precision - the precision to setpublic int getPrecision()
public String toString()
toString in class ObjectObject.toString()Copyright © 2018. All rights reserved.