Package fj

Enum Digit

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Digit>

    public enum Digit
    extends java.lang.Enum<Digit>
    The digits zero to nine.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      _0
      Zero.
      _1
      One.
      _2
      Two.
      _3
      Three.
      _4
      Four.
      _5
      Five.
      _6
      Six.
      _7
      Seven.
      _8
      Eight.
      _9
      Nine.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static F<java.lang.Character,​Option<Digit>> fromChar
      First-class conversion from a character to a digit.
      static F<java.lang.Long,​Digit> fromLong
      First-class conversion from a long to a digit.
      static F<Digit,​java.lang.Character> toChar
      First-class conversion from a digit to a character.
      static F<Digit,​java.lang.Long> toLong
      First-class conversion from digit to a long.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Digit()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Option<Digit> fromChar​(char c)
      Converts the given character in the given long value to a digit.
      static Digit fromLong​(long i)
      Converts the right-most digit in the given long value to a digit.
      char toChar()
      Converts this digit to a character.
      long toLong()
      Converts this digit to a long.
      static Digit valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Digit[] 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

      • _0

        public static final Digit _0
        Zero.
      • _1

        public static final Digit _1
        One.
      • _2

        public static final Digit _2
        Two.
      • _3

        public static final Digit _3
        Three.
      • _4

        public static final Digit _4
        Four.
      • _5

        public static final Digit _5
        Five.
      • _6

        public static final Digit _6
        Six.
      • _7

        public static final Digit _7
        Seven.
      • _8

        public static final Digit _8
        Eight.
      • _9

        public static final Digit _9
        Nine.
    • Field Detail

      • toLong

        public static final F<Digit,​java.lang.Long> toLong
        First-class conversion from digit to a long.
      • fromLong

        public static final F<java.lang.Long,​Digit> fromLong
        First-class conversion from a long to a digit.
      • toChar

        public static final F<Digit,​java.lang.Character> toChar
        First-class conversion from a digit to a character.
      • fromChar

        public static final F<java.lang.Character,​Option<Digit>> fromChar
        First-class conversion from a character to a digit.
    • Constructor Detail

      • Digit

        private Digit()
    • Method Detail

      • values

        public static Digit[] 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 (Digit c : Digit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Digit 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
      • toLong

        public long toLong()
        Converts this digit to a long.
        Returns:
        A long for this digit.
      • toChar

        public char toChar()
        Converts this digit to a character.
        Returns:
        A character for this digit.
      • fromLong

        public static Digit fromLong​(long i)
        Converts the right-most digit in the given long value to a digit.
        Parameters:
        i - The long to convert.
        Returns:
        The right-most digit in the given long value as a digit.
      • fromChar

        public static Option<Digit> fromChar​(char c)
        Converts the given character in the given long value to a digit.
        Parameters:
        c - The character to convert.
        Returns:
        The character in the given long value as a digit.