Package soot.util

Class UnitMap<T>

  • All Implemented Interfaces:
    Map<Unit,​T>

    public abstract class UnitMap<T>
    extends Object
    implements Map<Unit,​T>
    Maps each unit to the result of mapTo.
    • 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 map 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 map 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 map is initialized to initialCapacity.
        Parameters:
        b - a Body
        initialCapacity - the initialCapacity of the internal map.
      • 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 map is initialized to initialCapacity.
        Parameters:
        g - a UnitGraph
        initialCapacity - the initialCapacity of the internal map.
      • 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 map is initialized to initialCapacity and loadFactor.
        Parameters:
        b - a Body
        initialCapacity - the initialCapacity of the internal map.
        loadFactor - the loadFactor of the internal map.
      • 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 map is initialized to initialCapacity and loadFactor.
        Parameters:
        g - a UnitGraph
        initialCapacity - the initialCapacity of the internal map.
        loadFactor - the loadFactor of the internal map.
    • 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 T 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:
        unit - 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<Unit,​T>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map<Unit,​T>
      • put

        public T put​(Unit key,
                     T value)
        Specified by:
        put in interface Map<Unit,​T>
      • putAll

        public void putAll​(Map<? extends Unit,​? extends T> t)
        Specified by:
        putAll in interface Map<Unit,​T>
      • size

        public int size()
        Specified by:
        size in interface Map<Unit,​T>