- 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 BitSetArray()
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntEnumeration
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.
-
-
-
Constructor Detail
-
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 Detail
-
set
public void set(int index, int bit)
Set a bit in a bit set.- Parameters:
index
- the index of the bit setbit
- 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!
-
-