Package net.cscott.jutil
Class BitSetFactory<V>
java.lang.Object
net.cscott.jutil.BitSetFactory<V>
- All Implemented Interfaces:
CollectionFactory<V>,SetFactory<V>
BitSetFactory is a SetFactory that,
given a complete universe of possible values, produces low space
overhead representations of Sets.
Notably, the Sets produced should have union,
intersection, and difference operations that, while still O(n),
have blazingly low constant factors.
The addition operations (Set.add(Object) and its
cousins) are only defined for objects that are part of the
universe of values given to the constructor; other Objects will
cause IllegalArgumentException to be thrown.- Author:
- Felix S. Klock II <pnkfelix@mit.edu>
-
Constructor Summary
ConstructorsConstructorDescriptionBitSetFactory(Collection<V> universe) Creates aBitSetFactory, given auniverseof values.BitSetFactory(Collection<V> universe, Indexer<V> indexer) -
Method Summary
Modifier and TypeMethodDescriptionGenerates a new mutableSet, using the elements of the universe forthisas its initial contents.net.cscott.jutil.BitSetFactory.BitStringSet<V> makeSet(Collection<? extends V> c) Generates a new mutableSet, using the elements ofcas a template for its initial contents.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.cscott.jutil.SetFactory
makeCollection, makeCollection, makeCollection, makeSet, makeSet
-
Constructor Details
-
BitSetFactory
-
BitSetFactory
Creates aBitSetFactory, given auniverseof values. Makes a newIndexerforuniverse; the createdIndexerwill implement theIndexer.getByID()method to allow efficient iteration over sets.
-
-
Method Details
-
makeSet
Generates a new mutableSet, using the elements ofcas a template for its initial contents.
requires: All of the elements ofcmust have been part of the universe forthis.
effects: Constructs a lightweightSetwith the elements fromc.- Specified by:
makeSetin interfaceSetFactory<V>
-
makeFullSet
Generates a new mutableSet, using the elements of the universe forthisas its initial contents.
-