Package daikon
Class 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
Nested Classes Modifier and Type Class Description 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
Fields Modifier and Type Field Description static Logger
debug
Debug tracer.static Logger
debugFlow
static Logger
debugGeneral
Debug tracer for debugging both this and PptSlices.static Logger
debugGuarding
List<Invariant>
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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addInvariant(Invariant inv)
boolean
allPrestate()
Returns true if all of this slice's variables are orig() variables.abstract int
arity()
boolean
contains_inv(Invariant inv)
Returns whether or not this slice already contains the specified invariant.boolean
contains_inv_exact(Invariant inv)
Returns whether or not this slice contains an exact match for the specified invariant.boolean
containsOnlyGuardingPredicates()
PptSlice
copy_new_invs(PptTopLevel ppt, VarInfo[] vis)
@Nullable Invariant
find_inv_by_class(Class<? extends Invariant> cls)
Returns the invariant that matches the specified class if it exists.@Nullable 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.boolean
usesVar(VarInfo vi)
boolean
usesVar(String name)
boolean
usesVarDerived(String name)
Returns true if any of our variables is named NAME, or is derived from a variable named NAME.-
Methods inherited from class Ppt
containsVar, find_var_by_name, indexOf, trimToSize, varNames, varNames
-
-
-
-
Field Detail
-
debugGeneral
public static final Logger debugGeneral
Debug tracer for debugging both this and PptSlices.
-
debugGuarding
public static final Logger debugGuarding
-
parent
public PptTopLevel parent
This is a slice of the 'parent' ppt.
-
invs
public List<Invariant> 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 viaaddInvariant(daikon.inv.Invariant)
andremoveInvariant(daikon.inv.Invariant)
.
-
-
Method Detail
-
arity
public abstract int arity(@UnknownInitialization(PptSlice.class) PptSlice this)
-
name
@SideEffectFree public final String name(@GuardSatisfied @UnknownInitialization(PptSlice.class) PptSlice this)
-
usesVarDerived
public boolean usesVarDerived(String name)
Returns true if any of our variables is named NAME, or is derived from a variable named 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.- 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
@RequiresNonNull("daikon.suppress.NIS.suppressor_map") protected void remove_falsified()
Removes any falsified invariants from our list.
-
num_samples
public abstract int num_samples(@UnknownInitialization @GuardSatisfied PptSlice this)
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)
-
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
@EnsuresNonNullIf(result=true, expression="find_inv_exact(#1)") 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
@Pure public @Nullable 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 @Nullable 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
@Pure 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.
-
-