|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.jutil.CollectionFactory<V> net.cscott.jutil.SetFactory<V> net.cscott.jutil.BitSetFactory<V>
public class BitSetFactory<V>
BitSetFactory
is a SetFactory
that,
given a complete universe of possible values, produces low space
overhead representations of Set
s.
Notably, the Set
s 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.
Constructor Summary | |
---|---|
BitSetFactory(Collection<V> universe)
Creates a BitSetFactory , given a
universe of values. |
|
BitSetFactory(Collection<V> universe,
Indexer<V> indexer)
Creates a BitSetFactory , given a
universe of values and an Indexer
for the elements of universe . |
Method Summary | |
---|---|
Set<V> |
makeFullSet()
Generates a new mutable Set , using the elements
of the universe for this as its initial contents. |
net.cscott.jutil.BitSetFactory.BitStringSet<V> |
makeSet(Collection<? extends V> c)
Generates a new mutable Set , using the elements
of c as a template for its initial contents. |
Methods inherited from class net.cscott.jutil.SetFactory |
---|
makeCollection, makeCollection, makeCollection, makeSet, makeSet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitSetFactory(Collection<V> universe, Indexer<V> indexer)
BitSetFactory
, given a
universe
of values and an Indexer
for the elements of universe
.
public BitSetFactory(Collection<V> universe)
BitSetFactory
, given a
universe
of values. Makes a new
Indexer
for universe
; the
created Indexer
will implement the
Indexer.getByID()
method to allow
efficient iteration over sets.
Method Detail |
---|
public net.cscott.jutil.BitSetFactory.BitStringSet<V> makeSet(Collection<? extends V> c)
Set
, using the elements
of c
as a template for its initial contents.
c
must have been part of the universe for
this
.
Set
with the elements from c
.
makeSet
in class SetFactory<V>
public Set<V> makeFullSet()
Set
, using the elements
of the universe for this
as its initial contents.
|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |