Class MutableMapping<T>

java.lang.Object
com.ibm.wala.util.intset.MutableMapping<T>
All Implemented Interfaces:
OrdinalSetMapping<T>, Serializable, Iterable<T>

public class MutableMapping<T> extends Object implements OrdinalSetMapping<T>, Serializable
A bit set mapping based on an object array. This is not terribly efficient, but is useful for prototyping.
See Also:
  • Constructor Details

    • MutableMapping

      public MutableMapping(Object[] array)
      Throws:
      IllegalArgumentException - if array is null
    • MutableMapping

      protected MutableMapping()
  • Method Details

    • make

      public static <T> MutableMapping<T> make()
    • getMappedObject

      public T getMappedObject(int n)
      Specified by:
      getMappedObject in interface OrdinalSetMapping<T>
      Returns:
      the object numbered n.
    • getMappedIndex

      public int getMappedIndex(Object o)
      Specified by:
      getMappedIndex in interface OrdinalSetMapping<T>
      Returns:
      the number of a given object, or -1 if the object is not currently in the range.
    • hasMappedIndex

      public boolean hasMappedIndex(T o)
      Specified by:
      hasMappedIndex in interface OrdinalSetMapping<T>
      Returns:
      whether the given object is mapped by this mapping
    • add

      public int add(T o)
      Add an object to the set of mapped objects.
      Specified by:
      add in interface OrdinalSetMapping<T>
      Returns:
      the integer to which the object is mapped.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • makeSingleton

      public OrdinalSet<T> makeSingleton(int i)
    • deleteMappedObject

      public void deleteMappedObject(T n)
    • getObjects

      public Collection<T> getObjects()
    • replace

      public void replace(T a, T b) throws IllegalArgumentException
      Replace a in this mapping with b.
      Throws:
      IllegalArgumentException
    • put

      public void put(int i, T o)
      Add an object to the set of mapped objects at index i.
    • getMaximumIndex

      public int getMaximumIndex()
      Specified by:
      getMaximumIndex in interface OrdinalSetMapping<T>
      Returns:
      the maximum integer mapped to an object
    • getSize

      public int getSize()
      Specified by:
      getSize in interface OrdinalSetMapping<T>
      Returns:
      the current size of the bijection