Enum Unit

  • All Implemented Interfaces:
    com.globalmentor.lex.Identifier, com.globalmentor.lex.Token, java.io.Serializable, java.lang.Comparable<Unit>

    public enum Unit
    extends java.lang.Enum<Unit>
    implements com.globalmentor.lex.Identifier
    A unit of measurement.
    Author:
    Garret Wilson
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CENTIMETER
      Centimeters.
      EM
      The size of a font.
      EX
      The x-height of a font.
      INCH
      Inches.
      MILLIMETER
      Millimeters.
      PICA
      Picas, or 12 points.
      PIXEL
      Pixels relative to the viewing device.
      POINT
      Points, or 1/72 of an inch.
      RELATIVE
      Pure relative units (i.e.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Unit valueOf​(java.lang.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

      • EM

        public static final Unit EM
        The size of a font.
      • EX

        public static final Unit EX
        The x-height of a font.
      • PIXEL

        public static final Unit PIXEL
        Pixels relative to the viewing device.
      • INCH

        public static final Unit INCH
        Inches.
      • CENTIMETER

        public static final Unit CENTIMETER
        Centimeters.
      • MILLIMETER

        public static final Unit MILLIMETER
        Millimeters.
      • POINT

        public static final Unit POINT
        Points, or 1/72 of an inch.
      • PICA

        public static final Unit PICA
        Picas, or 12 points.
      • RELATIVE

        public static final Unit RELATIVE
        Pure relative units (i.e. the fractional form of a percentage).
    • 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​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null