daikon
Class PptSliceEquality

Object
  extended by Ppt
      extended by PptSlice
          extended by PptSliceEquality
All Implemented Interfaces:
Serializable

public class PptSliceEquality
extends PptSlice

Holds Equality invariants.

See Also:
Serialized Form

Nested Class Summary
static class PptSliceEquality.EqualityComparator
          Order Equality invariants by the indices of leaders.
 
Nested classes/interfaces inherited from class PptSlice
PptSlice.ArityPptnameComparator, PptSlice.ArityVarnameComparator
 
Nested classes/interfaces inherited from class Ppt
Ppt.NameComparator
 
Field Summary
static Logger debug
           
static Logger debugGlobal
           
static boolean dkconfig_set_per_var
          If true, create one equality set for each variable.
 
Fields inherited from class PptSlice
debugFlow, debugGeneral, debugGuarding, invs, lineSep, parent
 
Fields inherited from class Ppt
emptyInvList, var_infos
 
Method Summary
 List<Invariant> add(ValueTuple vt, int count)
          Returns a List of Invariants that have been weakened/destroyed.
 void addInvariant(Invariant inv)
           
 int arity()
           
 List<Invariant> copyInvsFromLeader(VarInfo leader, List<VarInfo> newVis)
          Instantiate invariants from each inv's leader.
 List<Equality> createEqualityInvs(List<VarInfo> vis, Equality leader)
          Create a List of Equality invariants based on the VarInfos in vis.
 VarInfo[] get_leaders_sorted()
          Returns an array of all of the leaders sorted by varinfo_index for this equality view.
 void instantiate_from_pairs(Set<VarInfo.Pair> eset)
          Instantiate the full equality sets from a set of variable pairs where each member of a pair is equal to the other.
 int num_mod_samples()
           
 int num_samples()
          Return an approximation of the number of samples seen on this slice
 int num_values()
          Return an approximation of the number of distinct values seen on this slice
 void repCheck()
          Check the internals of this slice.
 String toString()
          For debugging only.
 
Methods inherited from class PptSlice
allPrestate, contains_inv_exact, contains_inv, containsOnlyGuardingPredicates, copy_new_invs, find_inv_by_class, find_inv_exact, is_inv_true, log, name, processOmissions, remove_falsified, removeInvariant, removeInvariants, trimToSize, usesVar, usesVar, usesVarDerived
 
Methods inherited from class Ppt
containsVar, find_var_by_name, indexOf, varNames, varNames
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dkconfig_set_per_var

public static boolean dkconfig_set_per_var
If true, create one equality set for each variable. This has the effect of turning the equality optimization off, without actually removing the sets themselves (which are presumed to exist in many parts of the code).


debug

public static final Logger debug

debugGlobal

public static final Logger debugGlobal
Method Detail

arity

public final int arity()
Specified by:
arity in class PptSlice

addInvariant

public void addInvariant(Invariant inv)
Specified by:
addInvariant in class PptSlice

num_samples

public int num_samples()
Description copied from class: PptSlice
Return an approximation of the number of samples seen on this slice

Specified by:
num_samples in class PptSlice

num_mod_samples

public int num_mod_samples()

num_values

public int num_values()
Description copied from class: PptSlice
Return an approximation of the number of distinct values seen on this slice

Specified by:
num_values in class PptSlice

instantiate_from_pairs

public void instantiate_from_pairs(Set<VarInfo.Pair> eset)
Instantiate the full equality sets from a set of variable pairs where each member of a pair is equal to the other.


add

public List<Invariant> add(ValueTuple vt,
                           int count)
Returns a List of Invariants that have been weakened/destroyed. However, this handles the creation of new Equality invariants and the instantiation of other invariants.

Returns:
a List of invariants that have been weakened

createEqualityInvs

public List<Equality> createEqualityInvs(List<VarInfo> vis,
                                         Equality leader)
Create a List of Equality invariants based on the VarInfos in vis. Assumes that the VarInfos in vis are not missing. The method is used exclusively for reversing optimizations in Daikon.

Parameters:
vis - The VarInfos that were different from leader
leader - The original leader of VarInfos
Returns:
a List of Equality invariants bundling together same values from vis. pre vis.size() > 0 post result.size() > 0

copyInvsFromLeader

public List<Invariant> copyInvsFromLeader(VarInfo leader,
                                          List<VarInfo> newVis)
Instantiate invariants from each inv's leader. This is like instantiate_invariants at the start of reading the trace file, where we create new PptSliceNs. This is called when newVis have just split off from leader, and we want the leaders of newVis to have the same invariants as leader.

Parameters:
leader - the old leader
newVis - a List of new VarInfos that used to be equal to leader. Actually, it's the list of canonical that were equal to leader, representing their own newly-created equality sets. post: Adds the newly instantiated invariants and slices to this.parent.

repCheck

public void repCheck()
Description copied from class: PptSlice
Check the internals of this slice. Each invariant in the slice is checked for consistency and each inv.ppt must equal this

Overrides:
repCheck in class PptSlice

toString

public String toString()
Description copied from class: PptSlice
For debugging only.

Overrides:
toString in class PptSlice

get_leaders_sorted

public VarInfo[] get_leaders_sorted()
Returns an array of all of the leaders sorted by varinfo_index for this equality view.