Class EnumBitSet<E extends Enum<E>>

java.lang.Object
org.ojalgo.type.EnumBitSet<E>

public final class EnumBitSet<E extends Enum<E>> extends Object
Like a BitSet but using an Enum as indices. The Enum cannot have more than 64 values as the internal storage is a single long.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
     
    private long
    Stores the 64 boolean values
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Clears all bits, setting all booleans to false
    (package private) boolean
    get(long mask)
    Get the boolean value corresponding to the mask
    boolean
    get(E index)
     
    (package private) long
    Returns the internal long value (optional, useful for debugging or serialization)
    private static long
    mask(Enum<?> index)
     
    (package private) void
    set(long mask, boolean value)
    Set the boolean value corresponding to the mask
    void
    set(E index, boolean value)
     
    (package private) void
    setBitSet(long bitSet)
    Sets the internal long value directly (optional, useful for debugging or deserialization)

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MASK_MUST_HAVE_EXACTLY_ONE_BIT_SET

      private static final String MASK_MUST_HAVE_EXACTLY_ONE_BIT_SET
      See Also:
    • myBitSet

      private long myBitSet
      Stores the 64 boolean values
  • Constructor Details

    • EnumBitSet

      public EnumBitSet()
  • Method Details

    • mask

      private static long mask(Enum<?> index)
    • get

      public boolean get(E index)
    • set

      public void set(E index, boolean value)
    • clear

      void clear()
      Clears all bits, setting all booleans to false
    • get

      boolean get(long mask)
      Get the boolean value corresponding to the mask
    • getBitSet

      long getBitSet()
      Returns the internal long value (optional, useful for debugging or serialization)
    • set

      void set(long mask, boolean value)
      Set the boolean value corresponding to the mask
    • setBitSet

      void setBitSet(long bitSet)
      Sets the internal long value directly (optional, useful for debugging or deserialization)