soot.util
Class UnitMap

java.lang.Object
  |
  +--soot.util.UnitMap

public abstract class UnitMap
extends java.lang.Object
implements java.util.Map

Maps each unit to the result of mapTo.


Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
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(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(java.lang.Object key)
           
 int hashCode()
           
protected  void init()
          allows one-time initialization before any mapping.
 boolean isEmpty()
           
 java.util.Set keySet()
           
protected abstract  java.lang.Object mapTo(Unit unit)
          maps a unit to an object.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map t)
           
 java.lang.Object remove(java.lang.Object key)
           
 int size()
           
 java.util.Collection 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 java.lang.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 java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Map
Overrides:
equals in class java.lang.Object

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map

putAll

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

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map

size

public int size()
Specified by:
size in interface java.util.Map

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map