de.caff.util

## Class BitMaskUtil

- java.lang.Object
- - de.caff.util.BitMaskUtil

-     public class BitMaskUtil
      extends java.lang.Object

  Helper class for bit masks.
  Author:
    Rammi

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `areEqual(BitMask mask1, BitMask mask2)` Are two bit masks equal?
    `static <T extends java.lang.Enum<T> & BitFlag> boolean` | `areEqual(EnumBitMask<T> mask1, EnumBitMask<T> mask2)` Are two enum bit masks equal?
    `static int` | `getHash64(long value)` Get a hash value for a long value.
    `static BitMask` | `toBitMask(BitFlag flag)` Convert a bit flag into a bit mask.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getHash64

          public static int getHash64(long value)

      Get a hash value for a long value.
      Parameters:
        `value` - long value
      Returns:
        hash value

    - #### areEqual

          public static boolean areEqual(@NotNull
                                         BitMask mask1,
                                         @NotNull
                                         BitMask mask2)

      Are two bit masks equal?

      This compares whether the same bit flags are set in both masks. For masks with different lengths the missing flags in the shorter mask are considered to be unset.

      Parameters:
        `mask1` - first mask
        `mask2` - second mask
      Returns:
        `true` if both masks are considered equal, otherwise `false`

    - #### areEqual

          public static <T extends java.lang.Enum<T> & BitFlag> boolean areEqual(@NotNull
                                                                                 EnumBitMask<T> mask1,
                                                                                 @NotNull
                                                                                 EnumBitMask<T> mask2)

      Are two enum bit masks equal?
      Type Parameters:
        `T` - enum bit flag
      Parameters:
        `mask1` - first mask
        `mask2` - second mask
      Returns:
        `true` if both masks are considered equal, otherwise `false`

    - #### toBitMask

          @NotNull
          public static BitMask toBitMask(@NotNull
                                                   BitFlag flag)

      Convert a bit flag into a bit mask.
      Parameters:
        `flag` - bit flag
      Returns:
        bit mask with the given flag set and all others unset