|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | ||||||||
java.lang.Objectjava.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. |
BigDecimal |
convertTo(BigDecimal d,
LengthUnit other,
MathContext mc)
|
double |
convertTo(double d,
LengthUnit other)
|
float |
convertTo(float d,
LengthUnit other)
|
Number |
convertTo(Number d,
LengthUnit other,
MathContext mc)
Convert from this unit to another. |
String |
format(Number n)
|
static LengthUnit |
fromSymbol(String s)
|
LengthUnit |
getCommonUnit(LengthUnit o)
|
String |
getSymbol()
The symbol for this unit of length. |
static Length |
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 PICA
public static final LengthUnit POINT
| 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 BigDecimal convertTo(BigDecimal d,
LengthUnit other,
MathContext mc)
public final Number convertTo(Number d,
LengthUnit other,
MathContext mc)
d is a Float or Double then native
operators are used, otherwise it is converted to BigDecimal and converted using
mc. NOTE : this method doesn't always return the same type that it was passed,
e.g. passing (int)1 can return new BigDecimal("2.54").
d - a length, e.g. 1.other - another unit, e.g. CM.mc - only used if d is not a Float or Double.
INCH.
public final double convertTo(double d,
LengthUnit other)
public final float convertTo(float d,
LengthUnit other)
public final String format(Number n)
public final LengthUnit getCommonUnit(LengthUnit o)
public static final LengthUnit fromSymbol(String s)
public static final Length 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 | ||||||||