Class GenericBitSet<E>

Type Parameters:
E - type of elements
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Set<E>, SetEx<E>, Copyable<SetEx<E>>
Direct Known Subclasses:
IndexerBitSet

public abstract class GenericBitSet<E> extends AbstractSetEx<E> implements Serializable
Bit set based implementation of Set.

To store objects in bit set, the subclasses need to take care of the mappings between objects and indexes by implementing getIndex(E) and getElement(int). The objects stored in the same bit set s should preserve the invariant: e.equals(s.getElement(s.getIndex(e))).

Note: objects in different contexts may be mapped to the same index, and it may cause unexpected behaviors if they are stored in the same bit set. To avoid this, for each bit set, we require the subclasses to provide a context object which indicates the context of the objects represented by the bits in the set. We consider set operations (e.g., addAll(java.util.Collection<? extends E>) and containsAll(java.util.Collection<?>)) meaningful only when the two bit sets have the equivalent context object.

TODO: add mod count

See Also: