|
|||||||||
| Home >> All >> Util >> [ Collections overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
Util.Collections
Interface Relation

- All Known Implementing Classes:
- AbstrRelation
- public interface Relation
Relation is a mathematical relation, accepting one to many
and many to one mappings.
It is similar to harpoon.Util.Collections.MultiMap but it is intended to be simpler and better tailored for the implementation of the Pointer Analysis algorithm.
- Version:
- $Id: Relation.java,v 1.2 2003/05/12 10:05:21 joewhaley Exp $
| Nested Class Summary | |
static interface |
Relation.EntryVisitor
RelationEntryVisitor is a wrapper for a function that is
called on a relation entry of the form <key,value>. |
| Method Summary | |
boolean |
add(java.lang.Object key,
java.lang.Object value)
Adds the pair <key, value> to the relation. |
boolean |
addAll(java.lang.Object key,
java.util.Collection values)
Adds a relation from key to each element of the set
values. |
java.lang.Object |
clone()
Clones this relation. |
boolean |
contains(java.lang.Object key,
java.lang.Object value)
Checks the existence of the relation <key,value>. |
boolean |
containsKey(java.lang.Object key)
Checks the existence of the key key in this relation. |
boolean |
equals(java.lang.Object o)
Checks the equality of two relations |
void |
forAllEntries(Relation.EntryVisitor visitor)
Visits all the entries <key,value> of
this relation and calls visitor.visit
on each of them. |
java.util.Set |
getValues(java.lang.Object key)
Returns the image of key through this relation. |
boolean |
isEmpty()
Tests if this relation is empty or not. |
java.util.Set |
keys()
Returns all the keys appearing in this relation. |
void |
remove(java.lang.Object key,
java.lang.Object value)
Removes the relation between key and
value. |
void |
removeAll(java.lang.Object key,
java.util.Collection values)
Removes the relation between key and
any element from values. |
void |
removeKey(java.lang.Object key)
Removes all the relations attached to key. |
void |
removeKeys(PredicateWrapper predicate)
Removes all the keys that satisfy predicate.check(). |
void |
removeObjects(PredicateWrapper predicate)
Removes all the relations involving at least one object that satisfy predicate.check(). |
void |
removeValues(PredicateWrapper predicate)
Removes all the values that satisfy predicate.check(). |
Relation |
select(java.util.Collection selected_keys)
Returns the subrelation of this relation that contains only the keys that appear in selected_keys. |
void |
union(Relation rel)
Combines this relation with a new one. |
java.util.Set |
values()
Returns all the values appearing in this relation. |
| Method Detail |
add
public boolean add(java.lang.Object key, java.lang.Object value)
- Adds the pair
<key, value>to the relation. Returnstrueif the new relation is bigger.
addAll
public boolean addAll(java.lang.Object key, java.util.Collection values)
- Adds a relation from
keyto each element of the setvalues.valuesshould not contain duplicated elements. Returnstrueif the new relation is bigger.
remove
public void remove(java.lang.Object key, java.lang.Object value)
- Removes the relation between
keyandvalue.
removeAll
public void removeAll(java.lang.Object key, java.util.Collection values)
- Removes the relation between
keyand any element fromvalues.
removeKey
public void removeKey(java.lang.Object key)
- Removes all the relations attached to
key.
removeKeys
public void removeKeys(PredicateWrapper predicate)
- Removes all the keys that satisfy
predicate.check().
removeValues
public void removeValues(PredicateWrapper predicate)
- Removes all the values that satisfy
predicate.check().
removeObjects
public void removeObjects(PredicateWrapper predicate)
- Removes all the relations involving at least one object that
satisfy
predicate.check().
contains
public boolean contains(java.lang.Object key, java.lang.Object value)
- Checks the existence of the relation
<key,value>.
containsKey
public boolean containsKey(java.lang.Object key)
- Checks the existence of the
keykey in this relation.
isEmpty
public boolean isEmpty()
- Tests if this relation is empty or not.
getValues
public java.util.Set getValues(java.lang.Object key)
- Returns the image of
keythrough this relation. The returned collection is guarranted not to contain duplicates. Can returnnullif no value is attached to key. If the result is non-null, additions and removals on the returned collection take effect on the relation.
keys
public java.util.Set keys()
- Returns all the keys appearing in this relation. The result is
guaranted not to contain duplicates.
values
public java.util.Set values()
- Returns all the values appearing in this relation.
union
public void union(Relation rel)
- Combines
thisrelation with a new one. Anullparameter is considered to be an empty relation.
equals
public boolean equals(java.lang.Object o)
- Checks the equality of two relations
select
public Relation select(java.util.Collection selected_keys)
- Returns the subrelation of this relation that contains
only the keys that appear in
selected_keys.
forAllEntries
public void forAllEntries(Relation.EntryVisitor visitor)
- Visits all the entries
<key,value>ofthisrelation and callsvisitor.visiton each of them.
clone
public java.lang.Object clone()
- Clones this relation.
|
|||||||||
| Home >> All >> Util >> [ Collections overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC