Module org.maxicp

Class BitSet

java.lang.Object
org.maxicp.state.datastructures.BitSet
Direct Known Subclasses:
StateSparseBitSet.CollectionBitSet, StateSparseBitSet.SupportBitSet

public class BitSet extends Object
Bitset abstract class
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected long[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BitSet(int nWords)
    Initializes a bit-set.
    BitSet(BitSet anotherBitSet)
    Copy a bitset.
    BitSet(BitSet anotherBitSet, boolean shared)
    Copy or share a bitset.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Unset all the bits
    void
    Makes the intersection with another bit-set but only on non zero-words of the outer sparse-bit-set.
    void
     
    void
    set(int i)
    Set the ith bit up (value 1).
     
    void
    union(BitSet other)
    Makes the union with another bit-set but only on non zero-words of the outer sparse-bit-set.
    void
    unset(int i)
    Set the ith bit down (value 0).

    Methods inherited from class java.lang.Object

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

    • words

      protected long[] words
    • nbWords

      protected int nbWords
  • Constructor Details

    • BitSet

      public BitSet(int nWords)
      Initializes a bit-set. All the bits are initially unset. The set it represents is thus empty.
    • BitSet

      public BitSet(BitSet anotherBitSet)
      Copy a bitset. The bit set in anotherBitSet are also set here.
      Parameters:
      anotherBitSet - bitset to be copied
    • BitSet

      public BitSet(BitSet anotherBitSet, boolean shared)
      Copy or share a bitset. If the sharing is chosen, operations on one impacts the other as well
      Parameters:
      anotherBitSet - bitset to be copied/shared
      shared - true if the internal representation is meant to be shared between multiple bitsets
  • Method Details

    • set

      public void set(int i)
      Set the ith bit up (value 1).
      Parameters:
      i - the bit to set
    • unset

      public void unset(int i)
      Set the ith bit down (value 0).
      Parameters:
      i - the bit to set
    • clear

      public void clear()
      Unset all the bits
    • union

      public void union(BitSet other)
      Makes the union with another bit-set but only on non zero-words of the outer sparse-bit-set.
      Parameters:
      other - the other bit-set to make the union with
    • intersect

      public void intersect(BitSet other)
      Makes the intersection with another bit-set but only on non zero-words of the outer sparse-bit-set.
      Parameters:
      other - the other bit-set to make the intersection with
    • invert

      public void invert()
    • toString

      public String toString()
      Overrides:
      toString in class Object