Module openj9.dtfj

Class BitSetArray

java.lang.Object
com.ibm.j9ddr.corereaders.tdump.zebedee.util.BitSetArray

public class BitSetArray extends Object
This class provides a compact representation of an array of sparse bit sets. Each individual set is implemented by one of a number of classes which provide optimum memory usage for the size of set.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new BitSetArray with the default number of members being 16 (it will grow as necessary).
    BitSetArray(int size)
    Create a new BitSetArray with the given number of members (it will still grow as necessary if an attempt is made to set bits at an index greater than the given size).
  • Method Summary

    Modifier and Type
    Method
    Description
    elements(int index)
    Returns an IntEnumeration of all the elements in the set at the given index.
    void
    or(int toIndex, int fromIndex)
    Do a boolean OR operation on the two sets.
    void
    set(int index, int bit)
    Set a bit in a bit set.

    Methods declared in class java.lang.Object

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

    • BitSetArray

      public BitSetArray(int size)
      Create a new BitSetArray with the given number of members (it will still grow as necessary if an attempt is made to set bits at an index greater than the given size).
      Parameters:
      size - the initial number of sets
    • BitSetArray

      public BitSetArray()
      Create a new BitSetArray with the default number of members being 16 (it will grow as necessary).
  • Method Details

    • set

      public void set(int index, int bit)
      Set a bit in a bit set.
      Parameters:
      index - the index of the bit set
      bit - the number of the bit in the bit set
    • or

      public void or(int toIndex, int fromIndex)
      Do a boolean OR operation on the two sets. The second set is ORed into the first set.
    • elements

      public IntEnumeration elements(int index)
      Returns an IntEnumeration of all the elements in the set at the given index. Note that the implementation of IntEnumeration that is returned has an important limitation: for performance reasons, these objects are reused and once you have reached the end of the enumeration (ie hasMoreElements returned false) the object may be recycled. For that reason you cannot call hasMoreElements more than once it has returned false. I can't think why you would want to do that but I just thought I'd mention it!