Module ojalgo

Class EnumBitSet<E extends java.lang.Enum<E>>


  • public final class EnumBitSet<E extends java.lang.Enum<E>>
    extends java.lang.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.
    • Constructor Summary

      Constructors 
      Constructor Description
      EnumBitSet()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void clear()
      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 getBitSet()
      Returns the internal long value (optional, useful for debugging or serialization)
      private static long mask​(java.lang.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 java.lang.Object

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

      • MASK_MUST_HAVE_EXACTLY_ONE_BIT_SET

        private static final java.lang.String MASK_MUST_HAVE_EXACTLY_ONE_BIT_SET
        See Also:
        Constant Field Values
      • myBitSet

        private long myBitSet
        Stores the 64 boolean values
    • Constructor Detail

      • EnumBitSet

        public EnumBitSet()
    • Method Detail

      • mask

        private static long mask​(java.lang.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)