daikon
Class PptSlice

Object
  extended by Ppt
      extended by PptSlice
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PptSlice0, PptSlice1, PptSlice2, PptSlice3, PptSliceEquality

public abstract class PptSlice
extends Ppt

A Slice is a view of some of the variables for a program point. A program point (that is, PptTopLevel) does not directly contain invariants. Instead, slices contain the invariants that involve (all) the Slice's variables.

Suppose a program point has variables A, B, C, and D. There would be 4 unary slices -- one each for variables A, B, C, and D. There would be 6 binary slices -- for {A,B}, {A,C}, {A,D}, {B,C}, {B,D}, and {C,D}. There would be 4 ternary slices -- for {A,B,C}, {A,B,D}, {A,C,D}, and {B,C,D}.

See Also:
Serialized Form

Nested Class Summary
static class PptSlice.ArityPptnameComparator
          This class is used for comparing PptSlice objects.
static class PptSlice.ArityVarnameComparator
          This class is used for comparing PptSlice objects.
 
Nested classes/interfaces inherited from class Ppt
Ppt.NameComparator
 
Field Summary
static Logger debug
          Debug tracer.
static Logger debugFlow
           
static Logger debugGeneral
          Debug tracer for debugging both this and PptSlices.
static Logger debugGuarding
           
 Invariants invs
          The invariants contained in this slice.
protected static String lineSep
           
 PptTopLevel parent
          This is a slice of the 'parent' ppt.
 
Fields inherited from class Ppt
emptyInvList, var_infos
 
Method Summary
abstract  void addInvariant(Invariant inv)
           
 boolean allPrestate()
           
abstract  int arity()
           
 boolean contains_inv_exact(Invariant inv)
          Returns whether or not this slice contains an exact match for the specified invariant.
 boolean contains_inv(Invariant inv)
          Returns whether or not this slice already contains the specified invariant.
 boolean containsOnlyGuardingPredicates()
           
 PptSlice copy_new_invs(PptTopLevel ppt, VarInfo[] vis)
           
 Invariant find_inv_by_class(Class<? extends Invariant> cls)
          Returns the invariant that matches the specified class if it exists.
 Invariant find_inv_exact(Invariant inv)
          Returns the invariant that matches the specified invariant if it exists.
 boolean is_inv_true(Invariant inv)
          Returns true if the invariant is true in this slice.
 void log(String msg)
          Output specified log information if the PtpSlice class, and this ppt and variables are enabled for logging
 String name()
           
abstract  int num_samples()
          Return an approximation of the number of samples seen on this slice
abstract  int num_values()
          Return an approximation of the number of distinct values seen on this slice
 void processOmissions(boolean[] omitTypes)
          Remove the invariants noted in omitTypes
protected  void remove_falsified()
          Removes any falsified invariants from our list.
 void removeInvariant(Invariant inv)
          This method actually removes the invariant from its PptSlice.
 void removeInvariants(List<Invariant> to_remove)
           
 void repCheck()
          Check the internals of this slice.
 String toString()
          For debugging only.
 void trimToSize()
          Trim the collections used in this PptSlice.
 boolean usesVar(String name)
           
 boolean usesVar(VarInfo vi)
           
 boolean usesVarDerived(String name)
           
 
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

lineSep

protected static final String lineSep

debug

public static final Logger debug
Debug tracer.


debugGeneral

public static final Logger debugGeneral
Debug tracer for debugging both this and PptSlices.


debugFlow

public static final Logger debugFlow

debugGuarding

public static final Logger debugGuarding

parent

public PptTopLevel parent
This is a slice of the 'parent' ppt.


invs

public Invariants invs
The invariants contained in this slice. This should not be used directly, in general. In particular, subclasses such as PptSlice0 need to synchronize it with other values. Therefore, it should be manipulated via addInvariant() and removeInvariant().

Method Detail

arity

public abstract int arity()

trimToSize

public void trimToSize()
Trim the collections used in this PptSlice.

Overrides:
trimToSize in class Ppt

name

public final String name()
Specified by:
name in class Ppt

usesVar

public boolean usesVar(VarInfo vi)

usesVar

public boolean usesVar(String name)

usesVarDerived

public boolean usesVarDerived(String name)
Returns:
true if any of our variables is named NAME, or is derived from a variable named NAME.

allPrestate

public boolean allPrestate()
Returns:
true if all of this slice's variables are orig() variables.

addInvariant

public abstract void addInvariant(Invariant inv)

removeInvariant

public void removeInvariant(Invariant inv)
This method actually removes the invariant from its PptSlice.


removeInvariants

public void removeInvariants(List<Invariant> to_remove)

remove_falsified

protected void remove_falsified()
Removes any falsified invariants from our list.


num_samples

public abstract int num_samples()
Return an approximation of the number of samples seen on this slice


num_values

public abstract int num_values()
Return an approximation of the number of distinct values seen on this slice


containsOnlyGuardingPredicates

public boolean containsOnlyGuardingPredicates()

processOmissions

public void processOmissions(boolean[] omitTypes)
Remove the invariants noted in omitTypes


repCheck

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


copy_new_invs

public PptSlice copy_new_invs(PptTopLevel ppt,
                              VarInfo[] vis)

toString

public String toString()
For debugging only.

Overrides:
toString in class Object

contains_inv

public boolean contains_inv(Invariant inv)
Returns whether or not this slice already contains the specified invariant. Whether not invariants match is determine by Invariant.match() This will return true for invariants of the same kind with different formulas (eg, one_of, bound, linearbinary)


contains_inv_exact

public boolean contains_inv_exact(Invariant inv)
Returns whether or not this slice contains an exact match for the specified invariant. An exact match requires that the invariants be of the same class and have the same formula


find_inv_exact

public Invariant find_inv_exact(Invariant inv)
Returns the invariant that matches the specified invariant if it exists. Otherwise returns null. An exact match requires that the invariants be of the same class and have the same formula


find_inv_by_class

public Invariant find_inv_by_class(Class<? extends Invariant> cls)
Returns the invariant that matches the specified class if it exists. Otherwise returns null.


is_inv_true

public boolean is_inv_true(Invariant inv)
Returns true if the invariant is true in this slice. This can occur if the invariant exists in this slice, is suppressed, or is obvious statically.


log

public void log(String msg)
Output specified log information if the PtpSlice class, and this ppt and variables are enabled for logging