|
||||||||||
| 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<Pair<T2,T1>>
edu.rice.cs.plt.collect.AbstractRelation.InverseRelation
protected class AbstractRelation.InverseRelation
An inverse of the enclosing relation, defined in terms of Pair.inverse(). Mutation is
supported, with changes reflected in the enclosing relation. Inherits the AbstractSet implementations
of AbstractCollection.toArray(), AbstractCollection.toArray(Object[]),
AbstractCollection.containsAll(java.util.Collection>), AbstractCollection.addAll(java.util.Collection extends E>),
AbstractCollection.retainAll(java.util.Collection>), AbstractSet.removeAll(java.util.Collection>),
java.util.AbstractSet#toString(), equals(Object), and hashCode(). All other
methods delegate to their corresponding methods in the enclosing AbstractRelation (inverting pairs
as necessary).
| Constructor Summary | |
|---|---|
protected |
AbstractRelation.InverseRelation()
|
| Method Summary | |
|---|---|
boolean |
add(Pair<T2,T1> pair)
Add Pair.make(p.first(), p.second()) to the set. |
boolean |
add(T2 f,
T1 s)
Add Pair.make(first, second) to the set. |
void |
clear()
|
boolean |
contains(Object o)
Test whether the set contains an object. |
boolean |
contains(T2 f,
T1 s)
Whether Pair.make(first, second) appears in the set. |
boolean |
containsFirst(T2 f)
Whether a pair with the given first value appears in the set. |
boolean |
containsSecond(T1 s)
Whether a pair with the given second value appears in the set. |
PredicateSet<T1> |
excludeFirsts()
The set of seconds for which there exists a (first, second) pair in the relation. |
PredicateSet<T2> |
excludeSeconds()
The set of firsts for which there exists a (first, second) pair in the relation. |
PredicateSet<T2> |
firstSet()
The set of firsts. |
boolean |
hasFixedSize()
true if this iterable is known to have a fixed size. |
Relation<T1,T2> |
inverse()
Produce the inverse of the relation, derived by swapping the elements of each pair. |
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. |
Iterator<Pair<T2,T1>> |
iterator()
|
PredicateSet<T1> |
matchFirst(T2 f)
The set of seconds corresponding to a specific first. |
PredicateSet<T2> |
matchSecond(T1 s)
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(T2 f,
T1 s)
Remove Pair.make(first, second) from the set. |
PredicateSet<T1> |
secondSet()
The set of seconds. |
int |
size()
Returns size(Integer.MAX_VALUE). |
int |
size(int bound)
Computes the size by traversing the iterator (requires linear time). |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, 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 |
|---|
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
protected AbstractRelation.InverseRelation()
| Method Detail |
|---|
public int size()
AbstractPredicateSetsize(Integer.MAX_VALUE).
size in interface SizedIterable<Pair<T2,T1>>size in interface Collection<Pair<T2,T1>>size in interface Set<Pair<T2,T1>>size in class AbstractPredicateSet<Pair<T2,T1>>public int size(int bound)
AbstractPredicateSet
size in interface SizedIterable<Pair<T2,T1>>size in class AbstractPredicateSet<Pair<T2,T1>>bound - Maximum result. Assumed to be nonnegative.public boolean isEmpty()
AbstractPredicateSetsize(1) == 0.
isEmpty in interface SizedIterable<Pair<T2,T1>>isEmpty in interface Collection<Pair<T2,T1>>isEmpty in interface Set<Pair<T2,T1>>isEmpty in class AbstractPredicateSet<Pair<T2,T1>>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<T2,T1>>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<T2,T1>>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<T2,T1>>public boolean contains(Object o)
AbstractPredicateSetAbstractCollection.contains(java.lang.Object)) is a linear search,
which is almost always unreasonable for a set.
contains in interface Relation<T2,T1>contains in interface Predicate<Object>contains in interface Collection<Pair<T2,T1>>contains in interface Set<Pair<T2,T1>>contains in class AbstractPredicateSet<Pair<T2,T1>>public Iterator<Pair<T2,T1>> iterator()
iterator in interface Iterable<Pair<T2,T1>>iterator in interface Collection<Pair<T2,T1>>iterator in interface Set<Pair<T2,T1>>iterator in class AbstractCollection<Pair<T2,T1>>public boolean add(Pair<T2,T1> pair)
RelationPair.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 Relation<T2,T1>add in interface Collection<Pair<T2,T1>>add in interface Set<Pair<T2,T1>>add in class AbstractCollection<Pair<T2,T1>>public boolean remove(Object o)
Relationo 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 Relation<T2,T1>remove in interface Collection<Pair<T2,T1>>remove in interface Set<Pair<T2,T1>>remove in class AbstractCollection<Pair<T2,T1>>public void clear()
clear in interface Collection<Pair<T2,T1>>clear in interface Set<Pair<T2,T1>>clear in class AbstractCollection<Pair<T2,T1>>
public boolean contains(T2 f,
T1 s)
RelationPair.make(first, second) appears in the set.
contains in interface Relation<T2,T1>contains in interface Predicate2<T2,T1>
public boolean add(T2 f,
T1 s)
RelationPair.make(first, second) to the set.
add in interface Relation<T2,T1>
public boolean remove(T2 f,
T1 s)
RelationPair.make(first, second) from the set.
remove in interface Relation<T2,T1>public Relation<T1,T2> inverse()
Relation
inverse in interface Relation<T2,T1>public PredicateSet<T2> firstSet()
Relation
firstSet in interface Relation<T2,T1>public boolean containsFirst(T2 f)
Relation
containsFirst in interface Relation<T2,T1>public PredicateSet<T1> matchFirst(T2 f)
Relation
matchFirst in interface Relation<T2,T1>public PredicateSet<T1> 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<T2,T1>public PredicateSet<T1> secondSet()
Relation
secondSet in interface Relation<T2,T1>public boolean containsSecond(T1 s)
Relation
containsSecond in interface Relation<T2,T1>public PredicateSet<T2> matchSecond(T1 s)
Relation
matchSecond in interface Relation<T2,T1>public PredicateSet<T2> 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<T2,T1>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||