de.caff.util

## Enum TriState

- java.lang.Object
- - java.lang.Enum<TriState>
  - - de.caff.util.TriState

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TriState>

      public enum TriState
      extends java.lang.Enum<TriState>

  A tri-state which is either on, off, or undefined.
  Since:
    December 19, 2022
  Author:
    Rammi

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `Off` Off state.
    `On` On state.
    `Undefined` Undefined state.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.lang.Boolean` | `bool` The boolean equivalent of this state.
    `static Indexable<TriState>` | `VALUES` The values of this enum.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TriState` | `fromBoolean(java.lang.Boolean bool)` Convert a nullable boolean into a tri-state.
    `static TriState` | `fromInternal(int internalValue)` Get the TriState enum associated with the given internal value.
    `static TriState` | `fromInternal(int internalValue, TriState defaultValue)` Get the TriState enum associated with the given internal value.
    `static TriState` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static TriState[]` | `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

    - #### On

          public static final TriState On

      On state.

    - #### Off

          public static final TriState Off

      Off state.

    - #### Undefined

          public static final TriState Undefined

      Undefined state.

  - ### Field Detail

    - #### bool

          @Nullable
          public final java.lang.Boolean bool

      The boolean equivalent of this state.

    - #### VALUES

          @NotNull
          public static final Indexable<TriState> VALUES

      The values of this enum. Use this instead of `values()` because it does not require internal array copying.

  - ### Method Detail

    - #### values

          public static TriState[] 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 (TriState c : TriState.values())
              System.out.println(c);

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

    - #### valueOf

          public static TriState 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

    - #### fromBoolean

          @NotNull
          public static TriState fromBoolean(@Nullable
                                                      java.lang.Boolean bool)

      Convert a nullable boolean into a tri-state.
      Parameters:
        `bool` - incoming boolean, possibly `null`
      Returns:
        tri-state equivalent of `bool`

    - #### fromInternal

          @Nullable
          public static TriState fromInternal(int internalValue)

      Get the TriState enum associated with the given internal value.
      Parameters:
        `internalValue` - internal value
      Returns:
        associated enum value, or `null` if there is none

    - #### fromInternal

          @NotNull
          public static TriState fromInternal(int internalValue,
                                                       @NotNull
                                                       TriState defaultValue)

      Get the TriState enum associated with the given internal value.
      Parameters:
        `internalValue` - internal value
        `defaultValue` - default value
      Returns:
        associated enum value, or `defaultValue` if there is none