Enum Class Unit
- All Implemented Interfaces:
Serializable,Comparable<Unit>,Constable
An enum of various common length units.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDeprecated. -
Method Summary
Modifier and TypeMethodDescriptiondoubleconvertFrom(Unit srcUnit, double value) Convert the given value in the given destination unit tothisunit.floatconvertFrom(Unit srcUnit, float value) Convert the given value in the given destination unit tothisunit.doubleConvert the given value inthisunit to the given destination unit.floatConvert the given value inthisunit to the given destination unit.static UnitReturns the enum constant of this class with the specified name.static Unit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
Inch
-
Point
-
Feet
-
Yard
-
Millimeter
-
Centimeter
-
Meter
-
Pica
-
TypographicalPoint
-
JadiceDocumentUnit
-
Pixel
Deprecated.Pixels depend on the screen resolution. Use Point for further implementations.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
convertTo
Convert the given value inthisunit to the given destination unit.- Parameters:
dstUnit- the destination (desired) unitvalue- the value- Returns:
- the value in destination units
- Throws:
NullPointerException- if dstUnit isnull
-
convertTo
Convert the given value inthisunit to the given destination unit.- Parameters:
dstUnit- the destination (desired) unitvalue- the value- Returns:
- the value in destination units
- Throws:
NullPointerException- if dstUnit isnull
-
convertFrom
Convert the given value in the given destination unit tothisunit.- Parameters:
srcUnit- the source (current) unitvalue- the value- Returns:
- the value in
thisunits - Throws:
NullPointerException- if srcUnit isnull
-
convertFrom
Convert the given value in the given destination unit tothisunit.- Parameters:
srcUnit- the source (current) unitvalue- the value- Returns:
- the value in
thisunits - Throws:
NullPointerException- if srcUnit isnull
-