|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<LengthUnit> org.jopendocument.dom.LengthUnit
public enum LengthUnit
Units of length.
Enum Constant Summary | |
---|---|
CM
The centimetre. |
|
INCH
The inch. |
|
MM
The millimetre. |
|
PICA
The pica (12pt i.e. 1/6in). |
|
POINT
The point (1/72in). |
Method Summary | |
---|---|
BigDecimal |
convertTo(BigDecimal d,
LengthUnit other)
Convert from this unit to another. |
String |
format(Number n)
|
static LengthUnit |
fromSymbol(String s)
|
String |
getSymbol()
The symbol for this unit of length. |
static Tuple2<BigDecimal,LengthUnit> |
parseLength(String l)
|
static BigDecimal |
parseLength(String l,
LengthUnit to)
Parse a length. |
static BigDecimal |
parsePositiveLength(String l,
LengthUnit to,
boolean strict)
|
static LengthUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static LengthUnit[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final LengthUnit MM
public static final LengthUnit CM
public static final LengthUnit INCH
public static final LengthUnit POINT
public static final LengthUnit PICA
Method Detail |
---|
public static LengthUnit[] values()
for (LengthUnit c : LengthUnit.values()) System.out.println(c);
public static LengthUnit valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic final String getSymbol()
public final BigDecimal convertTo(BigDecimal d, LengthUnit other)
d
- a length, eg 1.other
- another unit, eg CM
.
rounded
result, eg 2.54 if this is INCH
public final String format(Number n)
public static final LengthUnit fromSymbol(String s)
public static final Tuple2<BigDecimal,LengthUnit> parseLength(String l)
public static final BigDecimal parseLength(String l, LengthUnit to)
l
- the length, can be null
, e.g. "2.0cm".to
- the result unit, e.g. MM
.
null
if l
is, e.g. 20.public static final BigDecimal parsePositiveLength(String l, LengthUnit to, boolean strict)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |