de.caff.util

## Class EnumBitMask<E extends java.lang.Enum<E> & BitFlag>

- java.lang.Object
- - de.caff.util.EnumBitMask<E>

- Type Parameters:
    `E` - the enum bit flag type for which this mask is valid

      public final class EnumBitMask<E extends java.lang.Enum<E> & BitFlag>
      extends java.lang.Object

  Type safe bit flags. This class is immutable.
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static EnumBitMask<?>` | `NONE16` 16 bit mask with no flag set.
    `static EnumBitMask<?>` | `NONE32` 32 bit mask with no flag set.
    `static EnumBitMask<?>` | `NONE64` 64 bit mask with no flag set.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EnumBitMask(BitMask bitMask)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `EnumBitMask<E>` | `and(EnumBitMask<E> other)` Get a bit mask where all flags are set which are set in this and in another one.
    `<F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `cast(java.lang.Class<F> enumClass)` Cast this enum bit mask to one using a different kind of bit flags.
    `EnumBitMask<E>` | `clear(E flag)` Clear the given flag.
    `EnumBitMask<E>` | `clear(EnumBitMask<E> other)` Get a bit mask where all flags are cleared which are set in another one.
    `EnumBitMask<E>` | `clearAll(E... flags)` Clear all given flags.
    `EnumBitMask<E>` | `cleared()` Get a version of this enum bit mask where all flags are cleared.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine(F... bitFlags)` Combine bit flags using an arbitrary number of bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine(java.lang.Iterable<F> bitFlags)` Combine bit flags using an arbitrary number of bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine16(java.util.Collection<F> bitFlags)` Combine bit flags using at maximum 16 bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine16(F... bitFlags)` Combine bit flags using at maximum 16 bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine32(java.util.Collection<F> bitFlags)` Combine bit flags using at maximum 32 bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine32(F... bitFlags)` Combine bit flags using at maximum 32 bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine64(java.util.Collection<F> bitFlags)` Combine bit flags using at maximum 64 bits into a bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `combine64(F... bitFlags)` Combine bit flags using at maximum 64 bits into a bit mask.
    `boolean` | `equals(java.lang.Object o)`
    `java.util.List<E>` | `flags(java.lang.Class<E> flagType)` Get a list of all flags which are set in this mask.
    `EnumBitMask<E>` | `flip(E flag)` Flip the given flag.
    `EnumBitMask<E>` | `flipAll(E... flags)` Flip all given flags.
    `void` | `forEachSet(java.lang.Iterable<E> flags, java.util.function.Consumer<? super E> handler)` Call a handler for each of the given flags which is set in this bit mask.
    `void` | `forEachUnset(java.lang.Iterable<E> flags, java.util.function.Consumer<? super E> handler)` Call a handler for each of the given flags which is unset in this bit mask.
    `static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T>` | `get16(EnumBitMask<T> mask, T... flags)` Get a cached 16bit mask for a combination of flags.
    `static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T>` | `get16(int value, java.lang.Class<T> type)` Get a cached 16bit mask for the given value.
    `static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T>` | `get16(T... flags)` Get a cached 16bit mask for a combination of flags.
    `static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T>` | `get32(EnumBitMask<T> mask, T... flags)` Get a cached 32bit mask for a combination of flags.
    `static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T>` | `get32(java.lang.Integer value, java.lang.Class<T> type)` Get a cached 32bit mask for the given value.
    `static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T>` | `get32(T... flags)` Get a cached 32bit mask for a combination of flags.
    `java.util.List<E>` | `getAllCleared(E... flags)` Get a list of all flags which are not set in this mask.
    `java.util.List<E>` | `getAllCleared(java.lang.Iterable<E> flags)` Get a list of all flags which are not set in this mask.
    `java.util.List<E>` | `getAllSet(E... flags)` Get a list of all flags out of a given set which are set in this mask.
    `java.util.List<E>` | `getAllSet(java.lang.Iterable<E> flags)` Get a list of all flags which are set in this mask.
    `BitMask` | `getBitMask()` Get the underlying bit mask,
    `int` | `getCardinality()` Get the cardinality of this enum bit mask.
    `int` | `getHighestFlagSet()` Get the highest flag set.
    `int` | `getLowestFlagSet()` Get the lowest flag set.
    `int` | `hashCode()`
    `boolean` | `isEmpty()` Is no flag set?
    `boolean` | `isSet(E flag)` Is the given flag set?
    `boolean` | `isSetAll(java.util.Collection<E> flags)` Are all flags from the given collection set?
    `boolean` | `isSetAll(E... flags)` Are all flags from the given sequence set?
    `boolean` | `isSetAll(EnumBitMask<E> other)` Are all flags set in the other bitmask set in this bitmask, too?
    `boolean` | `isSetAny(java.util.Collection<E> flags)` Is any flag from the given collection set?
    `boolean` | `isSetAny(E... flags)` Is any flag from the given sequence set?
    `boolean` | `isSetAny(EnumBitMask<E> other)` Is any flag in both this and the other bit mask set?
    `EnumBitMask<E>` | `map(java.lang.Iterable<E> flagsToCheck, java.util.function.BiPredicate<? super E,java.lang.Boolean> mapping)` Map the chosen flags from this mask to another flag
    `EnumBitMask<E>` | `mapFromSet(java.lang.Iterable<E> flagsToCheck, java.util.function.Predicate<? super E> mapping)` Map the chosen set flags from this mask to another mask.
    `EnumBitMask<E>` | `mapFromUnset(java.lang.Iterable<E> flagsToCheck, java.util.function.Predicate<? super E> mapping)` Map the chosen unset flags from this mask to another mask.
    `EnumBitMask<E>` | `or(EnumBitMask<E> other)` Get a bit mask where all flags are set which are set in this or in another one.
    `EnumBitMask<E>` | `set(E flag)` Set the given flag.
    `EnumBitMask<E>` | `setAll(E... flags)` Set all given flags.
    `EnumBitMask<E>` | `setTo(E flag, boolean onOff)` Set or clear the given flag.
    `static <F extends java.lang.Enum<F> & BitFlag> java.util.Set<F>` | `toFlags(EnumBitMask<F> mask, java.lang.Class<F> enumClass)` Divide a bit mask into a set of flags.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `toMask(F flag)` Convert a flag to a generic bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `toMask16(F flag)` Convert a flag to a 16 bit bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `toMask32(F flag)` Convert a flag to a 32 bit bit mask.
    `static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F>` | `toMask64(F flag)` Convert a flag to a 64 bit bit mask.
    `java.lang.String` | `toString()` Get a string representation.
    `EnumBitMask<E>` | `unique16()` Get the unique object representing the given 16bit flags.
    `EnumBitMask<E>` | `unique32()` Get the unique object representing the given 32bit flags.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### NONE16

          public static final EnumBitMask<?> NONE16

      16 bit mask with no flag set.

    - #### NONE32

          public static final EnumBitMask<?> NONE32

      32 bit mask with no flag set.

    - #### NONE64

          public static final EnumBitMask<?> NONE64

      64 bit mask with no flag set.

  - ### Constructor Detail

    - #### EnumBitMask

          public EnumBitMask(@NotNull
                             BitMask bitMask)

      Constructor.
      Parameters:
        `bitMask` - initial flags

  - ### Method Detail

    - #### getBitMask

          @NotNull
          public BitMask getBitMask()

      Get the underlying bit mask,
      Returns:
        bit mask

    - #### isSet

          public boolean isSet(@NotNull
                               E flag)

      Is the given flag set?
      Parameters:
        `flag` - flag to check
      Returns:
        `true`: the flag is set
        `false`: the flag is not set

    - #### isSetAny

          public boolean isSetAny(@NotNull
                                  EnumBitMask<E> other)

      Is any flag in both this and the other bit mask set?
      Parameters:
        `other` - other bit mask
      Returns:
        `true`: if any bit is set in both masks
        `false`: if no bit is set in both masks

    - #### isSetAll

          public boolean isSetAll(@NotNull
                                  EnumBitMask<E> other)

      Are all flags set in the other bitmask set in this bitmask, too?
      Parameters:
        `other` - other bit mask
      Returns:
        `true`: if all set flags of the other mask are set in this mask
        `false`: if any flag set in the other mask is not set in this mask

    - #### isSetAny

          @SafeVarargs
          public final boolean isSetAny(@NotNull
                                                     E... flags)

      Is any flag from the given sequence set?
      Parameters:
        `flags` - flags to check
      Returns:
        `true`: if any bit flag is set in this masks
        `false`: if no bit flag is set in this masks

    - #### isSetAny

          public boolean isSetAny(@NotNull
                                  java.util.Collection<E> flags)

      Is any flag from the given collection set?
      Parameters:
        `flags` - flags to check
      Returns:
        `true`: if any bit flag is set in this masks
        `false`: if no bit flag is set in this masks

    - #### isSetAll

          @SafeVarargs
          public final boolean isSetAll(@NotNull
                                                     E... flags)

      Are all flags from the given sequence set?
      Parameters:
        `flags` - flags to check
      Returns:
        `true`: if every bit flag is set in this masks
        `false`: if any bit flag is not set in this masks

    - #### isSetAll

          public boolean isSetAll(@NotNull
                                  java.util.Collection<E> flags)

      Are all flags from the given collection set?
      Parameters:
        `flags` - flags to check
      Returns:
        `true`: if every bit flag is set in this masks
        `false`: if any bit flag is not set in this masks

    - #### or

          @NotNull
          public EnumBitMask<E> or(@NotNull
                                            EnumBitMask<E> other)

      Get a bit mask where all flags are set which are set in this or in another one.
      Parameters:
        `other` - other bit mask defining the flags which are set
      Returns:
        this bit mask, but with set flags
      See Also:
        `and(EnumBitMask)`, `clear(EnumBitMask)`

    - #### and

          @NotNull
          public EnumBitMask<E> and(@NotNull
                                             EnumBitMask<E> other)

      Get a bit mask where all flags are set which are set in this and in another one.
      Parameters:
        `other` - other bit mask defining the flags which are set
      Returns:
        this bit mask, but with set flags
      See Also:
        `or(EnumBitMask)`, `clear(EnumBitMask)`

    - #### set

          @NotNull
          public EnumBitMask<E> set(@NotNull
                                             E flag)

      Set the given flag.
      Parameters:
        `flag` - flag to set
      Returns:
        bit mask where the given flag is set

    - #### setTo

          public EnumBitMask<E> setTo(@NotNull
                                      E flag,
                                      boolean onOff)

      Set or clear the given flag.
      Parameters:
        `flag` - flag to change
        `onOff` - `true`: set the flag
        `false`: clear the flag
      Returns:
        bit mask with flag change appropriately

    - #### setAll

          @SafeVarargs
           @NotNull
          public final EnumBitMask<E> setAll(@NotNull
                                                                    E... flags)

      Set all given flags.
      Parameters:
        `flags` - flags to set
      Returns:
        bit mask, where the flags of this mask and the given flags are set

    - #### clear

          @NotNull
          public EnumBitMask<E> clear(@NotNull
                                               E flag)

      Clear the given flag.
      Parameters:
        `flag` - flag to clear
      Returns:
        bit flags where the given flag is cleared

    - #### clear

          public EnumBitMask<E> clear(@NotNull
                                      EnumBitMask<E> other)

      Get a bit mask where all flags are cleared which are set in another one.
      Parameters:
        `other` - other bit mask defining the flags which are cleared
      Returns:
        this bit mask, but with cleared flags
      See Also:
        `and(EnumBitMask)`, `or(EnumBitMask)`

    - #### clearAll

          @SafeVarargs
           @NotNull
          public final EnumBitMask<E> clearAll(@NotNull
                                                                      E... flags)

      Clear all given flags.
      Parameters:
        `flags` - flags to clear
      Returns:
        bit mask, with the flags of this mask where all given flags are cleared

    - #### flip

          @NotNull
          public EnumBitMask<E> flip(@NotNull
                                              E flag)

      Flip the given flag.
      Parameters:
        `flag` - flag to flip
      Returns:
        bit flags where the given flag is inverted

    - #### flipAll

          @SafeVarargs
           @NotNull
          public final EnumBitMask<E> flipAll(@NotNull
                                                                     E... flags)

      Flip all given flags.
      Parameters:
        `flags` - flags to flip
      Returns:
        bit mask, with the flags of this mask where all given flags are flipped

    - #### getCardinality

          public int getCardinality()

      Get the cardinality of this enum bit mask. The cardinality is the number of flags which are set in this mask.
      Returns:
        cardinality
      See Also:
        `BitMask.getCardinality()`

    - #### getAllSet

          @NotNull
           @SafeVarargs
          public final java.util.List<E> getAllSet(@NotNull
                                                                          E... flags)

      Get a list of all flags out of a given set which are set in this mask.
      Parameters:
        `flags` - flags to check
      Returns:
        a list of all checked flags which are set in this mask
      See Also:
        `flags(Class)`, `getAllSet(Iterable)`

    - #### forEachSet

          public void forEachSet(@NotNull
                                 java.lang.Iterable<E> flags,
                                 @NotNull
                                 java.util.function.Consumer<? super E> handler)

      Call a handler for each of the given flags which is set in this bit mask.
      Parameters:
        `flags` - flags to check
        `handler` - handler called with all flags from `flags` that are set

    - #### forEachUnset

          public void forEachUnset(@NotNull
                                   java.lang.Iterable<E> flags,
                                   @NotNull
                                   java.util.function.Consumer<? super E> handler)

      Call a handler for each of the given flags which is unset in this bit mask.
      Parameters:
        `flags` - flags to check
        `handler` - handler called with all flags from `flags` that are unset

    - #### flags

          @NotNull
          public java.util.List<E> flags(@NotNull
                                                  java.lang.Class<E> flagType)

      Get a list of all flags which are set in this mask.
      Parameters:
        `flagType` - type of flags in this mask, must match the type of flags used in this mask. Necessary due to the quirks of the Java type system.
      Returns:
        flags set in this mask, in enum order
      See Also:
        `getAllSet(Enum[])`, `getAllSet(Iterable)`

    - #### getAllSet

          @NotNull
          public java.util.List<E> getAllSet(@NotNull
                                                      java.lang.Iterable<E> flags)

      Get a list of all flags which are set in this mask.
      Parameters:
        `flags` - flags to check
      Returns:
        ma list of all checked flags which are set in this maks
      See Also:
        `flags(Class)`, `getAllSet(Enum[])`

    - #### getAllCleared

          @NotNull
           @SafeVarargs
          public final java.util.List<E> getAllCleared(@NotNull
                                                                              E... flags)

      Get a list of all flags which are not set in this mask.
      Parameters:
        `flags` - flags to check
      Returns:
        a list of all checked flags which are not set in this mask

    - #### getAllCleared

          @NotNull
          public java.util.List<E> getAllCleared(@NotNull
                                                          java.lang.Iterable<E> flags)

      Get a list of all flags which are not set in this mask.
      Parameters:
        `flags` - flags to check
      Returns:
        ma list of all checked flags which are not set in this maks

    - #### getHighestFlagSet

          public int getHighestFlagSet()

      Get the highest flag set. This method interprets "highest" in the sense of the associated bit in the underlying bit mask (compare `BitMask.getHighestBitSet()`) and not in enum order.
      Returns:
        position of the highest flag bit set, `-1` if no flag is set

    - #### getLowestFlagSet

          public int getLowestFlagSet()

      Get the lowest flag set. This method interprets "lowest" in the sense of the associated bit in the underlying bit mask (compare `BitMask.getLowestBitSet()`) and not in enum order.
      Returns:
        position of the lowest flag bit set, `-1` if no flag is set

    - #### isEmpty

          public boolean isEmpty()

      Is no flag set?
      Returns:
        `true`: if no flag in this bit mask is set
        `false`: if any flag in this bit mask is set

    - #### cleared

          @NotNull
          public EnumBitMask<E> cleared()

      Get a version of this enum bit mask where all flags are cleared.
      Returns:
        empty enum bit mask

    - #### cast

          @NotNull
          public <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> cast(@NotNull
                                                                                      java.lang.Class<F> enumClass)

      Cast this enum bit mask to one using a different kind of bit flags.
      Type Parameters:
        `F` - type of enum bit flag class
      Parameters:
        `enumClass` - new enum bit flag class
      Returns:
        enum bit mask with same bit flags, but different enum flag type

    - #### unique16

          @NotNull
          public EnumBitMask<E> unique16()

      Get the unique object representing the given 16bit flags. This is an optimization which shares all enum bit masks with 16 bits.
      Returns:
        unique bitmask object representing the same flags as this one

    - #### unique32

          @NotNull
          public EnumBitMask<E> unique32()

      Get the unique object representing the given 32bit flags. This is an optimization which shares many enum bit masks with 32 bits.
      Returns:
        unique bitmask object representing the same flags as this one

    - #### mapFromSet

          @NotNull
          public EnumBitMask<E> mapFromSet(@NotNull
                                                    java.lang.Iterable<E> flagsToCheck,
                                                    @NotNull
                                                    java.util.function.Predicate<? super E> mapping)

      Map the chosen set flags from this mask to another mask.
      Parameters:
        `flagsToCheck` - set of flags to check from this mask
        `mapping` - predicate called for each checked flag which is set deciding which flags are set in the result
      Returns:
        new mask

    - #### mapFromUnset

          @NotNull
          public EnumBitMask<E> mapFromUnset(@NotNull
                                                      java.lang.Iterable<E> flagsToCheck,
                                                      @NotNull
                                                      java.util.function.Predicate<? super E> mapping)

      Map the chosen unset flags from this mask to another mask.
      Parameters:
        `flagsToCheck` - set of flags to check from this mask
        `mapping` - predicate called for each checked flag which is unset deciding which flags are set in the result
      Returns:
        new mask

    - #### map

          @NotNull
          public EnumBitMask<E> map(@NotNull
                                             java.lang.Iterable<E> flagsToCheck,
                                             @NotNull
                                             java.util.function.BiPredicate<? super E,java.lang.Boolean> mapping)

      Map the chosen flags from this mask to another flag
      Parameters:
        `flagsToCheck` - set of flags to check from this mask
        `mapping` - predicate called for each flag from the set, second parameter is `true` if the flag is set and `false` if it is unset
      Returns:
        new mask

    - #### toMask

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> toMask(@NotNull
                                                                                               F flag)

      Convert a flag to a generic bit mask.

      This internally uses a bit set bit mask, which allows for all possible flags.

      Type Parameters:
        `F` - type of bit flag
      Parameters:
        `flag` - flag to convert
      Returns:
        bit mask where bit flag is set

    - #### toMask16

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> toMask16(@NotNull
                                                                                                 F flag)

      Convert a flag to a 16 bit bit mask.
      Type Parameters:
        `F` - type of bit flag
      Parameters:
        `flag` - flag to convert
      Returns:
        bit mask where bit flag is set

    - #### toMask32

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> toMask32(@NotNull
                                                                                                 F flag)

      Convert a flag to a 32 bit bit mask.
      Type Parameters:
        `F` - type of bit flag
      Parameters:
        `flag` - flag to convert
      Returns:
        bit mask where bit flag is set

    - #### toMask64

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> toMask64(@NotNull
                                                                                                 F flag)

      Convert a flag to a 64 bit bit mask.
      Type Parameters:
        `F` - type of bit flag
      Parameters:
        `flag` - flag to convert
      Returns:
        bit mask where bit flag is set

    - #### toFlags

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> java.util.Set<F> toFlags(@NotNull
                                                                                                  EnumBitMask<F> mask,
                                                                                                  @NotNull
                                                                                                  java.lang.Class<F> enumClass)

      Divide a bit mask into a set of flags. Only valid bits (i.e. bits which have a flag counterpart) will be considered.
      Type Parameters:
        `F` - type of bit flag
      Parameters:
        `mask` - bit mask
        `enumClass` - class of the enum flags in this mask, necessary to overcome the shortcomings of Java generics
      Returns:
        set of bit flags which are set in the given mask
      See Also:
        `combine(Enum[])`, `combine(BitMask, Enum[])`, `combine16(Collection)`, `combine32(Collection)`, `combine64(Collection)`

    - #### combine16

          @SafeVarargs
           @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine16(F... bitFlags)

      Combine bit flags using at maximum 16 bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags
      Returns:
        bit mask
      See Also:
        `get16(Enum[])`

    - #### combine16

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine16(@NotNull
                                                                                                  java.util.Collection<F> bitFlags)

      Combine bit flags using at maximum 16 bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags to combine
      Returns:
        bit mask

    - #### combine32

          @SafeVarargs
           @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine32(F... bitFlags)

      Combine bit flags using at maximum 32 bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags
      Returns:
        bit mask
      See Also:
        `get32(Enum[])`

    - #### combine32

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine32(@NotNull
                                                                                                  java.util.Collection<F> bitFlags)

      Combine bit flags using at maximum 32 bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags to combine
      Returns:
        bit mask

    - #### combine64

          @SafeVarargs
           @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine64(F... bitFlags)

      Combine bit flags using at maximum 64 bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags
      Returns:
        bit mask

    - #### combine64

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine64(@NotNull
                                                                                                  java.util.Collection<F> bitFlags)

      Combine bit flags using at maximum 64 bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags
      Returns:
        bit mask

    - #### combine

          @SafeVarargs
           @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine(F... bitFlags)

      Combine bit flags using an arbitrary number of bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags
      Returns:
        bit mask

    - #### combine

          @NotNull
          public static <F extends java.lang.Enum<F> & BitFlag> EnumBitMask<F> combine(@NotNull
                                                                                                java.lang.Iterable<F> bitFlags)

      Combine bit flags using an arbitrary number of bits into a bit mask.
      Type Parameters:
        `F` - bit flag type
      Parameters:
        `bitFlags` - bit flags to combine
      Returns:
        bit mask

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Get a string representation.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        string representation

    - #### get16

          @NotNull
          public static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T> get16(int value,
                                                                                              @NotNull
                                                                                              java.lang.Class<T> type)

      Get a cached 16bit mask for the given value.

      This is an optimization reducing created bit masks.

      Type Parameters:
        `T` - enum type
      Parameters:
        `value` - value (an int only for convenience, only the low 16bits are used)
        `type` - enum type of returned
      Returns:
        matching bit mask

    - #### get16

          @SafeVarargs
           @NotNull
          public static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T> get16(T... flags)

      Get a cached 16bit mask for a combination of flags.

      This is an optimization reducing created bit masks.

      Type Parameters:
        `T` - enum type
      Parameters:
        `flags` - flags to combine
      Returns:
        matching bit mask

    - #### get16

          @SafeVarargs
           @NotNull
          public static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T> get16(@NotNull
                                                                                                            EnumBitMask<T> mask,
                                                                                                            @NotNull
                                                                                                            T... flags)

      Get a cached 16bit mask for a combination of flags.

      This is an optimization reducing created bit masks.

      Type Parameters:
        `T` - enum type
      Parameters:
        `mask` - basic mask
        `flags` - flags to combine with mask
      Returns:
        combined bit mask

    - #### get32

          @NotNull
          public static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T> get32(@NotNull
                                                                                              java.lang.Integer value,
                                                                                              @NotNull
                                                                                              java.lang.Class<T> type)

      Get a cached 32bit mask for the given value.

      This is an optimization reducing the number of created bit masks.

      Type Parameters:
        `T` - enum type
      Parameters:
        `value` - value
        `type` - enum type of returned
      Returns:
        matching bit mask

    - #### get32

          @SafeVarargs
           @NotNull
          public static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T> get32(T... flags)

      Get a cached 32bit mask for a combination of flags.

      This is an optimization reducing created bit masks.

      Type Parameters:
        `T` - enum type
      Parameters:
        `flags` - flags to combine
      Returns:
        matching bit mask

    - #### get32

          @SafeVarargs
           @NotNull
          public static <T extends java.lang.Enum<T> & BitFlag> EnumBitMask<T> get32(@NotNull
                                                                                                            EnumBitMask<T> mask,
                                                                                                            @NotNull
                                                                                                            T... flags)

      Get a cached 32bit mask for a combination of flags.

      This is an optimization reducing created bit masks.

      Type Parameters:
        `T` - enum type
      Parameters:
        `mask` - basic mask
        `flags` - flags to combine with mask
      Returns:
        combined bit mask