|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<T>
edu.rice.cs.plt.collect.AbstractPredicateSet<T>
edu.rice.cs.plt.collect.FilteredSet<T>
public class FilteredSet<T>
A set that contains only those elements contained by both the given set and the given predicate. Note that size operations will take linear time.
| Field Summary | |
|---|---|
protected Predicate<? super T> |
_pred
|
protected java.util.Set<? extends T> |
_set
|
| Constructor Summary | |
|---|---|
FilteredSet(java.util.Set<? extends T> set,
Predicate<? super T> predicate)
|
|
| Method Summary | |
|---|---|
int |
compositeHeight()
Get the maximum path length from this node to a leaf. |
int |
compositeSize()
Get the number of nodes in the tree rooted at this node. |
boolean |
contains(java.lang.Object o)
Test whether the set contains an object. |
boolean |
containsAll(java.util.Collection<?> objs)
|
boolean |
hasFixedSize()
true if this iterable is known to have a fixed size. |
boolean |
isEmpty()
Returns size(1) == 0. |
boolean |
isInfinite()
true if the iterable is known to have infinite size. |
boolean |
isStatic()
true if this iterable is unchanging. |
java.util.Iterator<T> |
iterator()
Traversing the iterator is linear in the size of the original set. |
| Methods inherited from class edu.rice.cs.plt.collect.AbstractPredicateSet |
|---|
size, size |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
add, addAll, clear, remove, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
add, addAll, clear, equals, hashCode, remove, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
protected final java.util.Set<? extends T> _set
protected final Predicate<? super T> _pred
| Constructor Detail |
|---|
public FilteredSet(java.util.Set<? extends T> set,
Predicate<? super T> predicate)
| Method Detail |
|---|
public int compositeHeight()
Composite
compositeHeight in interface Compositepublic int compositeSize()
Composite
compositeSize in interface Compositepublic boolean contains(java.lang.Object o)
AbstractPredicateSetAbstractCollection.contains(java.lang.Object)) is a linear search,
which is almost always unreasonable for a set.
contains in interface Predicate<java.lang.Object>contains in interface java.util.Collection<T>contains in interface java.util.Set<T>contains in class AbstractPredicateSet<T>public boolean containsAll(java.util.Collection<?> objs)
containsAll in interface java.util.Collection<T>containsAll in interface java.util.Set<T>containsAll in class java.util.AbstractCollection<T>public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>iterator in interface java.util.Collection<T>iterator in interface java.util.Set<T>iterator in class java.util.AbstractCollection<T>public boolean isEmpty()
AbstractPredicateSetsize(1) == 0.
isEmpty in interface SizedIterable<T>isEmpty in interface java.util.Collection<T>isEmpty in interface java.util.Set<T>isEmpty in class AbstractPredicateSet<T>public boolean isInfinite()
SizedIterabletrue if the iterable is known to have infinite size. If true, an iterator over the iterable in its
current state will never return false from hasNext().
isInfinite in interface SizedIterable<T>public boolean hasFixedSize()
SizedIterabletrue if this iterable is known to have a fixed size. This is the case if the iterable is immutable,
or if changes can only replace values, not remove or add them. An infinite iterable may be fixed if it
is guaranteed to never become finite.
hasFixedSize in interface SizedIterable<T>public boolean isStatic()
SizedIterabletrue if this iterable is unchanging. This implies that hasFixedSize() is true, and that
iterator() will always return the same (either == or equal() and immutable) elements
in the same order. ("Immutable" here means that equals() invocations are consistent over time -- if
two objects are equal, they will never become inequal, and vice versa.)
isStatic in interface SizedIterable<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||