edu.cmu.cs.crystal.simple
Class TupleLatticeElement<K,LE>

java.lang.Object
  extended by edu.cmu.cs.crystal.simple.TupleLatticeElement<K,LE>
Type Parameters:
K - The type of things that individual lattice elements are tracked for.
LE - The element type of the underlying lattice.

public class TupleLatticeElement<K,LE>
extends Object

Represents a lattice element that is a tuple of lattice elements for an underlying lattice. Conceptually, this is a map from keys to individual lattice elements for each key. Keys can be parameterized, but common keys are ASTNodes and 3-address code Variables. The representation is optimized: a default element is the assumed value for every key that has not been explicitly set. To use the TupleLatticeElement, create a TupleLatticeOperations. This lattice is mutable; the put(Object, Object) operation can be used to change its value.

Author:
aldrich, Kevin Bierhoff

Constructor Summary
TupleLatticeElement(LE b, LE d)
          Deprecated. 
 
Method Summary
 LE get(K n)
          Retrieves the lattice information for a given key.
 Set<K> getKeySet()
          Returns the set of keys for which lattice information was previously stored.
 LE put(K n, LE l)
          Sets an element in the tuple.
 LE remove(K n)
          Removes an element from the tuple.
 String toString()
          Prints the lattice element as a map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TupleLatticeElement

@Deprecated
public TupleLatticeElement(LE b,
                                      LE d)
Deprecated. 

Currently being used by Plural. Should not be used by anyone else

Parameters:
b - The bottom value for the underlying lattice
d - The default lattice value for the underlying lattice
See Also:
TupleLatticeOperations#getDefault()}
Method Detail

get

public LE get(K n)
Retrieves the lattice information for a given key.

Parameters:
n - The key for which lattice information is requested.
Returns:
bottom if this lattice is bottom, theDefault if n not found in map, or else the element at n in the map

put

public LE put(K n,
              LE l)
Sets an element in the tuple.

Parameters:
n - The Variable for which we are setting the value
l - The value to set
Returns:
The old value of the map

remove

public LE remove(K n)
Removes an element from the tuple.

Parameters:
n - Element to be removed
Returns:
Lattice information previously stored in the tuple or null if element wasn't in the tuple.

toString

public String toString()
Prints the lattice element as a map. Only non-default values are included.

Overrides:
toString in class Object
Returns:
String representing the tuple as a map.

getKeySet

public Set<K> getKeySet()
Returns the set of keys for which lattice information was previously stored. This set is backed by the tuple, thus removing elements from the set removes their entry in the tuple.

Returns:
The set of keys for which lattice information was previously stored. The result is never null but may be empty.
See Also:
Map.keySet()