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

java.lang.Object
  extended by edu.cmu.cs.crystal.simple.TupleLatticeOperations<K,LE>
All Implemented Interfaces:
IAbstractLatticeOperations<TupleLatticeElement<K,LE>,ASTNode>, ILatticeOperations<TupleLatticeElement<K,LE>>

public class TupleLatticeOperations<K,LE>
extends Object
implements ILatticeOperations<TupleLatticeElement<K,LE>>

Lattice operations for the TupleLatticeElement. To use TupleLatticeElement, create a TupleLatticeOperations with the appropriate lattice operations for the value lattice element and the default.

Since:
Crystal 3.4.0
Author:
ciera

Constructor Summary
TupleLatticeOperations(ILatticeOperations<LE> operations, LE defaultElement)
           
 
Method Summary
 boolean atLeastAsPrecise(TupleLatticeElement<K,LE> left, TupleLatticeElement<K,LE> right, ASTNode node)
          Compares analysis information for precision; more precisely, determines whether the first argument is at least as precise as the second.
 TupleLatticeElement<K,LE> bottom()
          Responsible for returning a lattice that represents no knowledge.
 TupleLatticeElement<K,LE> copy(TupleLatticeElement<K,LE> original)
          Creates a new deep copy of the given analysis information.
 TupleLatticeElement<K,LE> getDefault()
           
 TupleLatticeElement<K,LE> join(TupleLatticeElement<K,LE> left, TupleLatticeElement<K,LE> right, ASTNode node)
          Carries out a join on this lattice and another lattice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleLatticeOperations

public TupleLatticeOperations(ILatticeOperations<LE> operations,
                              LE defaultElement)
Parameters:
operations - The operations for the LE lattice
defaultElement - The default LE, to be used when we have a
Method Detail

atLeastAsPrecise

public boolean atLeastAsPrecise(TupleLatticeElement<K,LE> left,
                                TupleLatticeElement<K,LE> right,
                                ASTNode node)
Description copied from interface: IAbstractLatticeOperations
Compares analysis information for precision; more precisely, determines whether the first argument is at least as precise as the second. This method is used by the framework to compare analysis information.

Specified by:
atLeastAsPrecise in interface IAbstractLatticeOperations<TupleLatticeElement<K,LE>,ASTNode>
Specified by:
atLeastAsPrecise in interface ILatticeOperations<TupleLatticeElement<K,LE>>
Parameters:
left - Analysis information to be compared against reference
right - the other LE to compare info with.
node - ASTNode where the two paths were originally forked apart (e.g., if, while, try, switch, etc.) or null if this comparison occurs on a "dummy" node.
Returns:
true if the first argument is at least as precise as the second; false otherwise, including if the two arguments are incomparable.

bottom

public TupleLatticeElement<K,LE> bottom()
Description copied from interface: IAbstractLatticeOperations
Responsible for returning a lattice that represents no knowledge.

Specified by:
bottom in interface IAbstractLatticeOperations<TupleLatticeElement<K,LE>,ASTNode>
Specified by:
bottom in interface ILatticeOperations<TupleLatticeElement<K,LE>>
Returns:
the lattice that represents "bottom"

copy

public TupleLatticeElement<K,LE> copy(TupleLatticeElement<K,LE> original)
Description copied from interface: IAbstractLatticeOperations
Creates a new deep copy of the given analysis information. "Deep copy" means that all mutable (changeable) objects referenced by the given LE must not be referenced by the returned LE.

Specified by:
copy in interface IAbstractLatticeOperations<TupleLatticeElement<K,LE>,ASTNode>
Specified by:
copy in interface ILatticeOperations<TupleLatticeElement<K,LE>>
Parameters:
original - analysis information to be copied.
Returns:
a copy of the argument that contains no references to mutable objects found in the original.

join

public TupleLatticeElement<K,LE> join(TupleLatticeElement<K,LE> left,
                                      TupleLatticeElement<K,LE> right,
                                      ASTNode node)
Description copied from interface: IAbstractLatticeOperations
Carries out a join on this lattice and another lattice. This method is called by the framework to join different flows together. For example: The lattice that follows an If statement must represent the knowledge from the true and the false paths. The join is what combines the analysis of each path together. You may modify "this" and return it, or simply create a new LE and return it.

Specified by:
join in interface IAbstractLatticeOperations<TupleLatticeElement<K,LE>,ASTNode>
Specified by:
join in interface ILatticeOperations<TupleLatticeElement<K,LE>>
Parameters:
left - LE to join with otherInfo.
right - The other LE to join with, do not modify.
node - ASTNode where the two paths were originally forked apart (e.g., if, while, try, switch, etc.) or null if this join occurs on a "dummy" node.
Returns:
the resulting LE that has the combined knowledge

getDefault

public TupleLatticeElement<K,LE> getDefault()
Returns:
a default tuple lattice element which maps every key to the default value.