com.levigo.jadice.document
Enum Unit

java.lang.Object
  extended by java.lang.Enum<Unit>
      extended by com.levigo.jadice.document.Unit
All Implemented Interfaces:
Serializable, Comparable<Unit>

public enum Unit
extends Enum<Unit>

An enum of various common length units.


Enum Constant Summary
Centimeter
           
EnglishMetricUnit
           
Feet
           
HalfPoint
           
Inch
           
JadiceDocumentUnit
           
Meter
           
Millimeter
           
Pica
           
Point
           
Twip
           
TypographicalPoint
           
Yard
           
 
Method Summary
 double convertFrom(Unit srcUnit, double value)
          Convert the given value in the given destination unit to this unit.
 float convertFrom(Unit srcUnit, float value)
          Convert the given value in the given destination unit to this unit.
 double convertTo(Unit dstUnit, double value)
          Convert the given value in this unit to the given destination unit.
 float convertTo(Unit dstUnit, float value)
          Convert the given value in this unit to the given destination unit.
static Unit valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Unit[] 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

Inch

public static final Unit Inch

Point

public static final Unit Point

HalfPoint

public static final Unit HalfPoint

Twip

public static final Unit Twip

EnglishMetricUnit

public static final Unit EnglishMetricUnit

Feet

public static final Unit Feet

Yard

public static final Unit Yard

Millimeter

public static final Unit Millimeter

Centimeter

public static final Unit Centimeter

Meter

public static final Unit Meter

Pica

public static final Unit Pica

TypographicalPoint

public static final Unit TypographicalPoint

JadiceDocumentUnit

public static final Unit JadiceDocumentUnit
Method Detail

values

public static Unit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Unit c : Unit.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Unit valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
NullPointerException - if the argument is null

convertTo

public float convertTo(Unit dstUnit,
                       float value)
Convert the given value in this unit to the given destination unit.

Parameters:
dstUnit - the destination (desired) unit
value - the value
Returns:
the value in destination units
Throws:
NullPointerException - if dstUnit is null

convertTo

public double convertTo(Unit dstUnit,
                        double value)
Convert the given value in this unit to the given destination unit.

Parameters:
dstUnit - the destination (desired) unit
value - the value
Returns:
the value in destination units
Throws:
NullPointerException - if dstUnit is null

convertFrom

public float convertFrom(Unit srcUnit,
                         float value)
Convert the given value in the given destination unit to this unit.

Parameters:
srcUnit - the source (current) unit
value - the value
Returns:
the value in this units
Throws:
NullPointerException - if srcUnit is null

convertFrom

public double convertFrom(Unit srcUnit,
                          double value)
Convert the given value in the given destination unit to this unit.

Parameters:
srcUnit - the source (current) unit
value - the value
Returns:
the value in this units
Throws:
NullPointerException - if srcUnit is null


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.