|
||||||||||
| 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<T1,T2>>
edu.rice.cs.plt.collect.AbstractRelation<T1,T2>
edu.rice.cs.plt.collect.AbstractFunctionalRelation<T1,T2>
edu.rice.cs.plt.collect.IndexedFunctionalRelation<T1,T2>
public class IndexedFunctionalRelation<T1,T2>
An implementation of the FunctionalRelation interface based on indexing maps.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class edu.rice.cs.plt.collect.AbstractFunctionalRelation |
|---|
AbstractFunctionalRelation.InverseFunctionalRelation |
| Nested classes/interfaces inherited from class edu.rice.cs.plt.collect.AbstractRelation |
|---|
AbstractRelation.InverseRelation |
| Constructor Summary | |
|---|---|
IndexedFunctionalRelation()
Index in both directions using HashMaps and HashSets. |
|
IndexedFunctionalRelation(boolean indexSecond)
Index using HashMaps and HashSets. |
|
IndexedFunctionalRelation(Thunk<java.util.Map<T1,T2>> firstIndexFactory)
Create an index based on the given factory. |
|
IndexedFunctionalRelation(Thunk<java.util.Map<T1,T2>> firstIndexFactory,
Thunk<java.util.Map<T2,PredicateSet<T1>>> secondIndexFactory,
Thunk<java.util.Set<T1>> secondIndexEntryFactory)
Create indices based on the given factories. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(T1 first,
T2 second)
Add Pair.make(first, second) to the set. |
|
void |
clear()
|
|
LambdaMap<T1,T2> |
functionMap()
A map view of the relation, mapping firsts to seconds. |
|
boolean |
isStatic()
true if this iterable is unchanging. |
|
static
|
makeHashBased()
Make an IndexedFunctionalRelation indexed by HashMaps and HashSets. |
|
static
|
makeLinkedHashBased()
Make an IndexedFunctionalRelation indexed by LinkedHashMaps and LinkedHashSets. |
|
static
|
makeTreeBased()
Make an IndexedFunctionalRelation indexed by TreeMaps and TreeSets. |
|
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. |
|
| Methods inherited from class edu.rice.cs.plt.collect.AbstractFunctionalRelation |
|---|
contains, contains, containsFirst, firstSet, hasFixedSize, inverse, isEmpty, isInfinite, iterator, matchFirst, size, size, value |
| Methods inherited from class edu.rice.cs.plt.collect.AbstractRelation |
|---|
add, containsSecond, excludeFirsts, excludeSeconds, remove |
| 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 edu.rice.cs.plt.collect.FunctionalRelation |
|---|
add |
| Methods inherited from interface edu.rice.cs.plt.collect.Relation |
|---|
containsSecond, excludeFirsts, excludeSeconds, remove |
| Methods inherited from interface java.util.Set |
|---|
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public IndexedFunctionalRelation()
HashMaps and HashSets.
public IndexedFunctionalRelation(boolean indexSecond)
HashMaps and HashSets. If indexSecond
is false, no second-to-first index is created.
public IndexedFunctionalRelation(Thunk<java.util.Map<T1,T2>> firstIndexFactory,
Thunk<java.util.Map<T2,PredicateSet<T1>>> secondIndexFactory,
Thunk<java.util.Set<T1>> secondIndexEntryFactory)
firstIndexFactory - Maps firsts to seconds.secondIndexFactory - Maps seconds to sets of firsts.secondIndexEntryFactory - Produces sets for the second-to-first index.public IndexedFunctionalRelation(Thunk<java.util.Map<T1,T2>> firstIndexFactory)
firstIndexFactory - Maps firsts to seconds.| Method Detail |
|---|
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 AbstractFunctionalRelation<T1,T2>public LambdaMap<T1,T2> functionMap()
FunctionalRelation
functionMap in interface FunctionalRelation<T1,T2>functionMap in class AbstractFunctionalRelation<T1,T2>public PredicateSet<T2> secondSet()
Relation
secondSet in interface Relation<T1,T2>secondSet in class AbstractFunctionalRelation<T1,T2>public PredicateSet<T1> matchSecond(T2 second)
Relation
matchSecond in interface Relation<T1,T2>matchSecond in class AbstractFunctionalRelation<T1,T2>
public boolean add(T1 first,
T2 second)
RelationPair.make(first, second) to the set.
add in interface FunctionalRelation<T1,T2>add in interface Relation<T1,T2>add in class AbstractRelation<T1,T2>
public boolean remove(T1 first,
T2 second)
RelationPair.make(first, second) from the set.
remove in interface Relation<T1,T2>remove in class AbstractRelation<T1,T2>public void clear()
clear in interface java.util.Collection<Pair<T1,T2>>clear in interface java.util.Set<Pair<T1,T2>>clear in class java.util.AbstractCollection<Pair<T1,T2>>public static <T1,T2> IndexedFunctionalRelation<T1,T2> makeHashBased()
HashMaps and HashSets.
public static <T1,T2> IndexedFunctionalRelation<T1,T2> makeLinkedHashBased()
LinkedHashMaps and LinkedHashSets.
public static <T1 extends java.lang.Comparable<? super T1>,T2 extends java.lang.Comparable<? super T2>> IndexedFunctionalRelation<T1,T2> makeTreeBased()
TreeMaps and TreeSets.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||