|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<T>
edu.rice.cs.plt.collect.DelegatingCollection<T>
edu.rice.cs.plt.collect.DelegatingSet<Pair<T1,T2>>
edu.rice.cs.plt.collect.DelegatingRelation<T1,T2>
public class DelegatingRelation<T1,T2>
A relation that delegates all operations to a wrapped relation. Subclasses can be defined that
override a few of the methods, while maintaining the default delegation behavior in most cases.
Subclasses can also invoke the overridden methods in AbstractCollection to use the
default implementations there by invoking, for example, DelegatingCollection.abstractCollectionAddAll(java.util.Collection extends T>)
(see AbstractCollection for details on the default implementations).
| Field Summary | |
|---|---|
protected Relation<T1,T2> |
_delegate
|
| Constructor Summary | |
|---|---|
DelegatingRelation(Relation<T1,T2> delegate)
|
|
| Method Summary | |
|---|---|
boolean |
add(T1 first,
T2 second)
Add Pair.make(first, second) to the set. |
boolean |
contains(T1 first,
T2 second)
Whether Pair.make(first, second) appears in the set. |
boolean |
containsFirst(T1 first)
Whether a pair with the given first value appears in the set. |
boolean |
containsSecond(T2 second)
Whether a pair with the given second value appears in the set. |
PredicateSet<T2> |
excludeFirsts()
The set of seconds for which there exists a (first, second) pair in the relation. |
PredicateSet<T1> |
excludeSeconds()
The set of firsts for which there exists a (first, second) pair in the relation. |
PredicateSet<T1> |
firstSet()
The set of firsts. |
boolean |
hasFixedSize()
true if this iterable is known to have a fixed size. |
Relation<T2,T1> |
inverse()
Produce the inverse of the relation, derived by swapping the elements of each pair. |
boolean |
isInfinite()
true if the iterable is known to have infinite size. |
boolean |
isStatic()
true if this iterable is unchanging. |
PredicateSet<T2> |
matchFirst(T1 first)
The set of seconds corresponding to a specific first. |
PredicateSet<T1> |
matchSecond(T2 second)
The set of firsts corresponding to a specific second. |
boolean |
remove(T1 first,
T2 second)
Remove Pair.make(first, second) from the set. |
PredicateSet<T2> |
secondSet()
The set of seconds. |
int |
size(int bound)
Compute the number of elements in the iterable, up to the given bound. |
| Methods inherited from class edu.rice.cs.plt.collect.DelegatingSet |
|---|
equals, hashCode |
| Methods inherited from class edu.rice.cs.plt.collect.DelegatingCollection |
|---|
abstractCollectionAddAll, abstractCollectionClear, abstractCollectionContains, abstractCollectionContainsAll, abstractCollectionIsEmpty, abstractCollectionRemove, abstractCollectionRemoveAll, abstractCollectionRetainAll, abstractCollectionToArray, abstractCollectionToArray, add, addAll, clear, compositeHeight, compositeSize, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.rice.cs.plt.collect.Relation |
|---|
add, contains, remove |
| Methods inherited from interface java.util.Set |
|---|
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface edu.rice.cs.plt.iter.SizedIterable |
|---|
isEmpty, size |
| Field Detail |
|---|
protected final Relation<T1,T2> _delegate
| Constructor Detail |
|---|
public DelegatingRelation(Relation<T1,T2> delegate)
| Method Detail |
|---|
public int size(int bound)
SizedIterablebound, bound is returned.
size in interface SizedIterable<Pair<T1,T2>>size in class DelegatingCollection<Pair<T1,T2>>bound - Maximum result. Assumed to be nonnegative.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<Pair<T1,T2>>isInfinite in class DelegatingCollection<Pair<T1,T2>>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<Pair<T1,T2>>hasFixedSize in class DelegatingCollection<Pair<T1,T2>>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<Pair<T1,T2>>isStatic in class DelegatingCollection<Pair<T1,T2>>
public boolean contains(T1 first,
T2 second)
RelationPair.make(first, second) appears in the set.
contains in interface Relation<T1,T2>contains in interface Predicate2<T1,T2>
public boolean add(T1 first,
T2 second)
RelationPair.make(first, second) to the set.
add in interface Relation<T1,T2>
public boolean remove(T1 first,
T2 second)
RelationPair.make(first, second) from the set.
remove in interface Relation<T1,T2>public Relation<T2,T1> inverse()
Relation
inverse in interface Relation<T1,T2>public PredicateSet<T1> firstSet()
Relation
firstSet in interface Relation<T1,T2>public boolean containsFirst(T1 first)
Relation
containsFirst in interface Relation<T1,T2>public PredicateSet<T2> matchFirst(T1 first)
Relation
matchFirst in interface Relation<T1,T2>public PredicateSet<T2> excludeFirsts()
RelationRelation.secondSet(), but defined redundantly for consistency
with higher-arity relations. Need not allow mutation, but must reflect subsequent changes.
excludeFirsts in interface Relation<T1,T2>public PredicateSet<T2> secondSet()
Relation
secondSet in interface Relation<T1,T2>public boolean containsSecond(T2 second)
Relation
containsSecond in interface Relation<T1,T2>public PredicateSet<T1> matchSecond(T2 second)
Relation
matchSecond in interface Relation<T1,T2>public PredicateSet<T1> excludeSeconds()
RelationRelation.firstSet(), but defined redundantly for consistency
with higher-arity relations. Need not allow mutation, but must reflect subsequent changes.
excludeSeconds in interface Relation<T1,T2>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||