|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Relation<T1,T2>
A set of pairs representing a binary relation. Relations can be viewed as generalizations of maps in which keys map to sets of values, and the mapping occurs in both directions.
| Method Summary | |
|---|---|
boolean |
add(Pair<T1,T2> pair)
Add Pair.make(p.first(), p.second()) to the set. |
boolean |
add(T1 first,
T2 second)
Add Pair.make(first, second) to the set. |
boolean |
contains(Object o)
Whether the given object appears in 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. |
Relation<T2,T1> |
inverse()
Produce the inverse of the relation, derived by swapping the elements of each pair. |
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(Object o)
If o is a pair, remove Pair.make(o.first(), o.second()) from the set. |
boolean |
remove(T1 first,
T2 second)
Remove Pair.make(first, second) from the set. |
PredicateSet<T2> |
secondSet()
The set of seconds. |
| 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 |
|---|
hasFixedSize, isEmpty, isInfinite, isStatic, size, size |
| Method Detail |
|---|
boolean contains(Object o)
contains in interface Collection<Pair<T1,T2>>contains in interface Predicate<Object>contains in interface Set<Pair<T1,T2>>
boolean contains(T1 first,
T2 second)
Pair.make(first, second) appears in the set.
contains in interface Predicate2<T1,T2>boolean add(Pair<T1,T2> pair)
Pair.make(p.first(), p.second()) to the set. (That is, the pair that is
added is not an instance of some subclass of Pair.)
add in interface Collection<Pair<T1,T2>>add in interface Set<Pair<T1,T2>>
boolean add(T1 first,
T2 second)
Pair.make(first, second) to the set.
boolean remove(Object o)
o is a pair, remove Pair.make(o.first(), o.second()) from the set.
(That is, equality is always defined according to the Pair class's equals method, not
that of some subclass.)
remove in interface Collection<Pair<T1,T2>>remove in interface Set<Pair<T1,T2>>
boolean remove(T1 first,
T2 second)
Pair.make(first, second) from the set.
Relation<T2,T1> inverse()
PredicateSet<T1> firstSet()
boolean containsFirst(T1 first)
PredicateSet<T2> matchFirst(T1 first)
PredicateSet<T2> excludeFirsts()
secondSet(), but defined redundantly for consistency
with higher-arity relations. Need not allow mutation, but must reflect subsequent changes.
PredicateSet<T2> secondSet()
boolean containsSecond(T2 second)
PredicateSet<T1> matchSecond(T2 second)
PredicateSet<T1> excludeSeconds()
firstSet(), but defined redundantly for consistency
with higher-arity relations. Need not allow mutation, but must reflect subsequent changes.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||