soot.util
Class UnitMap

java.lang.Object
  extended by soot.util.UnitMap
All Implemented Interfaces:
Map

public abstract class UnitMap
extends Object
implements Map

Maps each unit to the result of mapTo.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
UnitMap(Body b)
          maps each unit of this body to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized without any parameter.
UnitMap(Body b, int initialCapacity)
          maps each unit of this body to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity.
UnitMap(Body b, int initialCapacity, float loadFactor)
          maps each unit of this body to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity and loadFactor.
UnitMap(UnitGraph g)
          maps each unit of the graph to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized without any parameter.
UnitMap(UnitGraph g, int initialCapacity)
          maps each unit of the graph to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity.
UnitMap(UnitGraph g, int initialCapacity, float loadFactor)
          maps each unit of the graph to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity and loadFactor.
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object o)
           
 Object get(Object key)
           
 int hashCode()
           
protected  void init()
          allows one-time initialization before any mapping.
 boolean isEmpty()
           
 Set<Object> keySet()
           
protected abstract  Object mapTo(Unit unit)
          maps a unit to an object.
 Object put(Object key, Object value)
           
 void putAll(Map t)
           
 Object remove(Object key)
           
 int size()
           
 Collection<Object> values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitMap

public UnitMap(Body b)
maps each unit of this body to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized without any parameter.

Parameters:
b - a Body

UnitMap

public UnitMap(UnitGraph g)
maps each unit of the graph to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized without any parameter.

Parameters:
g - a UnitGraph

UnitMap

public UnitMap(Body b,
               int initialCapacity)
maps each unit of this body to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity.

Parameters:
b - a Body
initialCapacity - the initialCapacity of the internal hashtable.

UnitMap

public UnitMap(UnitGraph g,
               int initialCapacity)
maps each unit of the graph to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity.

Parameters:
g - a UnitGraph
initialCapacity - the initialCapacity of the internal hashtable.

UnitMap

public UnitMap(Body b,
               int initialCapacity,
               float loadFactor)
maps each unit of this body to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity and loadFactor.

Parameters:
b - a Body
initialCapacity - the initialCapacity of the internal hashtable.
loadFactor - the loadFactor of the internal hashtable.

UnitMap

public UnitMap(UnitGraph g,
               int initialCapacity,
               float loadFactor)
maps each unit of the graph to the result of mapTo.
before the mapping the method init is called.
the internal hashtable is initialized to initialCapacity and loadFactor.

Parameters:
g - a UnitGraph
initialCapacity - the initialCapacity of the internal hashtable.
loadFactor - the loadFactor of the internal hashtable.
Method Detail

init

protected void init()
allows one-time initialization before any mapping. This method is called before any mapping of a unit (but only once in the beginning).
If not overwritten does nothing.


mapTo

protected abstract Object mapTo(Unit unit)
maps a unit to an object. This method is called for every unit. If the returned object is null no object will be mapped.

Parameters:
the - Unit to which o should be mapped.
Returns:
an object that is mapped to the unit, or null.

clear

public void clear()
Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

equals

public boolean equals(Object o)
Specified by:
equals in interface Map
Overrides:
equals in class Object

get

public Object get(Object key)
Specified by:
get in interface Map

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

keySet

public Set<Object> keySet()
Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

size

public int size()
Specified by:
size in interface Map

values

public Collection<Object> values()
Specified by:
values in interface Map