edu.mit.sketch.ddg
Class PrimitiveMapping

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--edu.mit.sketch.ddg.PrimitiveMapping
All Implemented Interfaces:
Cloneable, Map, Serializable

public class PrimitiveMapping
extends HashMap

Represents a one to one mapping between primitives of two different object descriptions. The keys are the primitives from one object, and the values are primitives from the other object. This class is used to find subobjects in objects.

PrimitiveMapping.java Created: Tue Feb 12 21:14:00 2002

See Also:
Serialized Form

Inner classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
PrimitiveMapping()
          Construct an empty mapping
PrimitiveMapping(PrimitiveMapping other)
          Construct a mapping the same as a given one
 
Method Summary
 void addPair(Primitive p1, Primitive p2)
          Add a new pair.
 boolean containsPair(Primitive p1, Primitive p2)
          Check whether a mached pair (in this order) exists in the mapping.
 Primitive getMapping(Primitive p)
          Get the primitive that maps to the given primitive.
 void removePair(Primitive p1, Primitive p2)
          Remove a pair.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

PrimitiveMapping

public PrimitiveMapping()
Construct an empty mapping

PrimitiveMapping

public PrimitiveMapping(PrimitiveMapping other)
Construct a mapping the same as a given one
Method Detail

containsPair

public boolean containsPair(Primitive p1,
                            Primitive p2)
Check whether a mached pair (in this order) exists in the mapping.

addPair

public void addPair(Primitive p1,
                    Primitive p2)
Add a new pair. The pair will only be added if these primitives do not already participate in the mapping.

removePair

public void removePair(Primitive p1,
                       Primitive p2)
Remove a pair.

getMapping

public Primitive getMapping(Primitive p)
Get the primitive that maps to the given primitive. If such mapping does not exist, returns null.