edu.rice.cs.plt.collect
Interface RelationIndex<K,V>

All Superinterfaces:
java.lang.Iterable<Pair<K,V>>, SizedIterable<Pair<K,V>>
All Known Implementing Classes:
ConcreteRelationIndex, LazyRelationIndex

public interface RelationIndex<K,V>
extends SizedIterable<Pair<K,V>>

Maintains an index mapping values of one type to sets of another. Useful in implementations of Relations.


Method Summary
 void added(K key, V value)
          Requests that the index be updated to reflect the addition of the given key/value pair.
 void cleared()
          Requests that the index be cleared to reflect the current state of the relation.
 boolean contains(java.lang.Object key, java.lang.Object value)
          Whether the given key-value mapping occurs.
 java.util.Iterator<Pair<K,V>> iterator()
          Iterates through all key-value pairs in the index.
 PredicateSet<K> keys()
          A dynamically-updating view of all keys mapping to at least one value.
 PredicateSet<V> match(K key)
          A dynamically-updating view of all values matching key.
 void removed(K key, V value)
          Requests that the index be updated to reflect the removal of the given key/value pair.
 
Methods inherited from interface edu.rice.cs.plt.iter.SizedIterable
hasFixedSize, isEmpty, isInfinite, isStatic, size, size
 

Method Detail

contains

boolean contains(java.lang.Object key,
                 java.lang.Object value)
Whether the given key-value mapping occurs.


keys

PredicateSet<K> keys()
A dynamically-updating view of all keys mapping to at least one value. Mutation (removal), if supported, will be automatically reflected in the relation being indexed.


match

PredicateSet<V> match(K key)
A dynamically-updating view of all values matching key. May be empty. Mutation, if supported, will be automatically reflected in the relation being indexed.


iterator

java.util.Iterator<Pair<K,V>> iterator()
Iterates through all key-value pairs in the index.

Specified by:
iterator in interface java.lang.Iterable<Pair<K,V>>

added

void added(K key,
           V value)
Requests that the index be updated to reflect the addition of the given key/value pair. Assumes the pair is not already present.


removed

void removed(K key,
             V value)
Requests that the index be updated to reflect the removal of the given key/value pair. Assumes the pair is present.


cleared

void cleared()
Requests that the index be cleared to reflect the current state of the relation. Assumes the index is non-empty.