|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface InjectiveRelation<T1,T2>
An injective relation: each second (of type T2) corresponds to at most one first
(of type T1). This can be viewed as modeling both a one-to-many relationship between
firsts and seconds and a function from seconds to firsts.
| Method Summary | |
|---|---|
boolean |
add(Pair<T1,T2> pair)
Add a pair to the set. |
boolean |
add(T1 first,
T2 second)
Add Pair.make(first, second) to the set. |
T1 |
antecedent(T2 second)
Produce the first corresponding to second, or null if there is none. |
LambdaMap<T2,T1> |
injectionMap()
A map view of the relation, mapping seconds to firsts. |
FunctionalRelation<T2,T1> |
inverse()
Produce the inverse of the relation, derived by swapping the elements of each pair. |
PredicateSet<T1> |
matchSecond(T2 second)
The set of firsts corresponding to a specific second. |
| Methods inherited from interface edu.rice.cs.plt.collect.Relation |
|---|
contains, contains, containsFirst, containsSecond, excludeFirsts, excludeSeconds, firstSet, matchFirst, remove, remove, secondSet |
| 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 |
|---|
T1 antecedent(T2 second)
second, or null if there is none.
LambdaMap<T2,T1> injectionMap()
boolean add(Pair<T1,T2> pair)
add in interface Collection<Pair<T1,T2>>add in interface Relation<T1,T2>add in interface Set<Pair<T1,T2>>IllegalArgumentException - If containsSecond(pair.second()) but not contains(pair).
boolean add(T1 first,
T2 second)
Pair.make(first, second) to the set. If the pair violates the cardinality constraint,
throw an exception.
add in interface Relation<T1,T2>IllegalArgumentException - If containsSecond(second) but not contains(first, second).FunctionalRelation<T2,T1> inverse()
inverse in interface Relation<T1,T2>PredicateSet<T1> matchSecond(T2 second)
matchSecond in interface Relation<T1,T2>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||