|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectharpoon.Analysis.PointerAnalysis.RelationImpl
public class RelationImpl
RelationImpl is a heavy-weight implementation of the
Relation interface: it is basically a Hashtable from keys
to HashSet's of values. It is good for very big relations but consumes
lots of memory.
| Constructor Summary | |
|---|---|
RelationImpl()
Creates an empty Relation. |
|
| Method Summary | |
|---|---|
boolean |
add(Object key,
Object value)
Adds the pair <key, value> to the relation. |
boolean |
addAll(Object key,
Collection values)
Adds a relation from key to each element of the set
values. |
Object |
clone()
Creates a new, independent relation (the operations on the new relation won't affect the old one). |
boolean |
contains(Object key,
Object value)
Checks the existence of the relation <key,value>. |
boolean |
containsKey(Object key)
Checks the existence of the key key in this relation. |
Relation |
convert(Map map,
Relation result)
Convert this relation through the mapping
map. |
boolean |
equals(Object o)
Checks the equality of two relations |
void |
forAllEntries(RelationEntryVisitor visitor)
Visits all the entries <key,value> of
this relation and calls visitor.visit
on each of them. |
Relation |
getEmptyRelation()
|
Set |
getValues(Object key)
Returns the image of key through this relation. |
boolean |
isEmpty()
Tests if this relation is empty or not. |
Set |
keys()
Returns all the keys appearing in this relation. |
void |
remove(Object key,
Object value)
Removes the relation between key and
value. |
void |
removeAll(Object key,
Collection values)
Removes the relation between key and
any element from values. |
void |
removeKey(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 |
revert(Relation result)
Revert this relation and store the result into
the relation result. |
Relation |
select(Collection selected_keys)
Returns the subrelation of this relation that contains only the keys that appear in selected_keys. |
String |
toString()
Pretty-print function for debug. |
boolean |
union(Relation rel)
Combines this relation with relation
rel. |
Set |
values()
Returns all the values appearing in this relation. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RelationImpl()
Relation.
| Method Detail |
|---|
public Relation getEmptyRelation()
public boolean add(Object key,
Object value)
Relation<key, value> to the relation.
Returns true if the new relation is bigger.
add in interface Relation
public boolean addAll(Object key,
Collection values)
Relationkey to each element of the set
values. values should not contain
duplicated elements.
Returns true if the new relation is bigger.
addAll in interface Relation
public void remove(Object key,
Object value)
Relationkey and
value.
remove in interface Relation
public void removeAll(Object key,
Collection values)
Relationkey and
any element from values.
removeAll in interface Relationpublic void removeKey(Object key)
Relationkey.
removeKey in interface Relationpublic void removeKeys(PredicateWrapper predicate)
Relationpredicate.check().
removeKeys in interface Relationpublic void removeValues(PredicateWrapper predicate)
Relationpredicate.check().
removeValues in interface Relationpublic void removeObjects(PredicateWrapper predicate)
Relationpredicate.check().
removeObjects in interface Relation
public boolean contains(Object key,
Object value)
Relation<key,value>.
contains in interface Relationpublic boolean containsKey(Object key)
Relationkey key in this relation.
containsKey in interface Relationpublic boolean isEmpty()
Relation
isEmpty in interface Relationpublic Set getValues(Object key)
Relationkey through this relation.
The returned collection is guarranted not to contain duplicates.
Can return null if no value is attached to key.
If the result is non-null, additions and removals on the returned
collection take effect on the relation.
getValues in interface Relationpublic Set keys()
Relation
keys in interface Relationpublic Set values()
Relation
values in interface Relationpublic boolean union(Relation rel)
Relationthis relation with relation
rel. A null parameter is considered
to be an empty relation.
union in interface Relationtrue iff this relation has
changed.public boolean equals(Object o)
Relation
equals in interface Relationequals in class Objectpublic Relation select(Collection selected_keys)
Relationselected_keys.
select in interface Relationpublic void forAllEntries(RelationEntryVisitor visitor)
Relation<key,value> of
this relation and calls visitor.visit
on each of them.
forAllEntries in interface Relationpublic Object clone()
clone in interface Relationclone in class Objectpublic String toString()
rel1.equals(rel2) <==> rel1.toString().equals(rel2.toString())
toString in class Objectpublic Relation revert(Relation result)
Relationthis relation and store the result into
the relation result. <a,b> appears in the
reverse relation iff <b,a> appears in this
relation. Returns the new relation (ie,
result).
revert in interface Relation
public Relation convert(Map map,
Relation result)
Relationthis relation through the mapping
map. The converted mapping contains all pairs
(a,b) such that there exists c,d
such that (c,d) appears in this
mapping, and map maps c to a and d to b. If an object is not
mapped to anything by map, it will be mapped to
itself by default. The result is stored in
result. Returns the converted mapping (ie,
result).
convert in interface Relation
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||