de.caff.generics

## Enum Order

- java.lang.Object
- - java.lang.Enum<Order>
  - - de.caff.generics.Order

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

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

  Order of two values.
  Since:
    January 11, 2023
  Author:
    Rammi

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `Ascending` First value comes before second value.
    `Descending` First value comes after second value.
    `Same` Values are the same.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean` | `ascending` Is this order ascending?
    `boolean` | `ascendingOrSame` Is this order ascending or the same?
    `int` | `comparison` The equivalent of this order when used for standard compare.
    `boolean` | `descending` Is this order descending?
    `boolean` | `descendingOrSame` Is this order descending or the same?
    `boolean` | `different` Is this order considering two values equal?
    `boolean` | `same` Is this order considering two values equal?
    `static Indexable<Order>` | `VALUES` The values of this enum.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Order` | `fromCompare(int value)` Get the order from a standard `Comparator` or `Comparable` result.
    `static Order` | `fromInternal(int internalValue)` Get the Order enum associated with the given internal value.
    `static Order` | `fromInternal(int internalValue, Order defaultValue)` Get the Order enum associated with the given internal value.
    `Order` | `inverse()` Get the order which is the inverse of this one.
    `static Order` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static Order[]` | `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

    - #### Ascending

          public static final Order Ascending

      First value comes before second value.

    - #### Same

          public static final Order Same

      Values are the same.

    - #### Descending

          public static final Order Descending

      First value comes after second value.

  - ### Field Detail

    - #### comparison

          public final int comparison

      The equivalent of this order when used for standard compare.

    - #### ascending

          public final boolean ascending

      Is this order ascending? This means that for two values `v1, v2` this order says that `v1 < v2`.

    - #### ascendingOrSame

          public final boolean ascendingOrSame

      Is this order ascending or the same? This means that for two values `v1, v2` this order says that `v1 <= v2`.

    - #### descending

          public final boolean descending

      Is this order descending? This means that for two values `v1, v2` this order says that `v2 > v1`.

    - #### descendingOrSame

          public final boolean descendingOrSame

      Is this order descending or the same? This means that for two values `v1, v2` this order says that `v1 >= v2`.

    - #### same

          public final boolean same

      Is this order considering two values equal? This means that for two values `v1, v2` this order says that `v1 == v2`.

    - #### different

          public final boolean different

      Is this order considering two values equal? This means that for two values `v1, v2` this order says that `v1 != v2`.

    - #### VALUES

          @NotNull
          public static final Indexable<Order> VALUES

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

  - ### Method Detail

    - #### values

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

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

    - #### valueOf

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

    - #### inverse

          @NotNull
          public Order inverse()

      Get the order which is the inverse of this one.
      Returns:
        inverse order

    - #### fromInternal

          @Nullable
          public static Order fromInternal(int internalValue)

      Get the Order 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 Order fromInternal(int internalValue,
                                                    @NotNull
                                                    Order defaultValue)

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

    - #### fromCompare

          @NotNull
          public static Order fromCompare(int value)

      Get the order from a standard `Comparator` or `Comparable` result.
      Parameters:
        `value` - comparison value, negative means ascending, positive means descending, `0` means same
      Returns:
        order equivalent