Enum Class Unit

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

public enum Unit extends Enum<Unit>
An enum of various common length units.
  • Enum Constant Details

    • 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 Details

    • values

      public static Unit[] 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

      public static Unit valueOf(String name)
      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 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