Package daikon.suppress
Class NISuppressionSet
- Object
-
- NISuppressionSet
-
- All Implemented Interfaces:
Iterable<NISuppression>
public class NISuppressionSet extends Object implements Iterable<NISuppression>
Class that defines a set of non-instantiating suppressions for a single invariant (suppressee).Not immutable: see recurse_definitions().
-
-
Constructor Summary
Constructors Constructor Description NISuppressionSet(NISuppression[] suppressions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add_to_suppressor_map(Map<Class<? extends Invariant>,List<NISuppressionSet>> suppressor_map)
Adds this set to the suppressor map.void
clear_state()
Clears the suppressor state in each suppression.void
falsified(Invariant inv, List<Invariant> new_invs)
NIS process a falsified invariant.NISuppressee
get_suppressee()
Returns the suppressee.boolean
is_instantiate_ok(PptSlice slice)
Determines whether or not the suppression set is valid in the specified slice.boolean
is_instantiate_ok(PptTopLevel ppt, VarInfo[] var_infos)
Determines whether or not the suppressee of the suppression set should be instantiated.Iterator<NISuppression>
iterator()
void
recurse_definitions(NISuppressionSet ss)
Side-effects this NISuppressionSet.boolean
suppressed(PptSlice slice)
Determines whether or not the suppression set is valid in the specified slice.boolean
suppressed(PptTopLevel ppt, VarInfo[] var_infos)
Determines whether or not the suppression set is valid in the specified ppt and var_infos.NISuppressionSet
swap()
Swaps each suppressor and suppressee to the opposite variable order.String
toString()
Returns a string containing each suppression separated by commas.-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
NISuppressionSet
public NISuppressionSet(NISuppression[] suppressions)
-
-
Method Detail
-
iterator
public Iterator<NISuppression> iterator()
- Specified by:
iterator
in interfaceIterable<NISuppression>
-
add_to_suppressor_map
public void add_to_suppressor_map(Map<Class<? extends Invariant>,List<NISuppressionSet>> suppressor_map)
Adds this set to the suppressor map. The map is from the class of the suppressor to this. If the same suppressor class appears more than once, the suppression is only added once.
-
falsified
public void falsified(Invariant inv, List<Invariant> new_invs)
NIS process a falsified invariant. This method should be called for each falsified invariant in turn. Any invariants for which inv is the last valid suppressor are added to new_invs.Note, this is no longer the preferred approach, but is kept for informational purposes. Use NIS.process_falsified_invs() instead.
-
suppressed
public boolean suppressed(PptSlice slice)
Determines whether or not the suppression set is valid in the specified slice. The suppression set is valid if any of its suppressions are valid. A suppression is valid if all of its suppressors are true.Also updates the debug information in each suppressor.
- See Also:
for a check that considers missing
-
suppressed
public boolean suppressed(PptTopLevel ppt, VarInfo[] var_infos)
Determines whether or not the suppression set is valid in the specified ppt and var_infos. The suppression set is valid if any of its suppressions are valid. A suppression is valid if all of its suppressors are true.Also updates the debug information in each suppressor.
- See Also:
for a check that considers missing
-
is_instantiate_ok
@Pure public boolean is_instantiate_ok(PptSlice slice)
Determines whether or not the suppression set is valid in the specified slice. The suppression set is valid if any of its suppressions are valid. A suppression is valid if all of its non-missing suppressors are true.
-
is_instantiate_ok
@Pure public boolean is_instantiate_ok(PptTopLevel ppt, VarInfo[] var_infos)
Determines whether or not the suppressee of the suppression set should be instantiated. Instantiation is ok only if each suppression is invalid. A suppression is valid if all of its non-missing suppressors are true.
-
recurse_definitions
public void recurse_definitions(NISuppressionSet ss)
Side-effects this NISuppressionSet. Each suppression where a suppressor matches the suppressee in ss is augmented by additional suppression(s) where the suppressor is replaced by each of its suppressions. This allows recursive suppressions.For example, consider the suppressions:
(r == arg1) ∧ (arg2 ≤ arg1) ⇒ r = max(arg1,arg2) (arg2 == arg1) ⇒ arg2 ≤ arg1
The suppressor (arg2 ≤ arg1) in the first suppression matches the suppressee in the second suppression. In order for the first suppression to work even when (arg2 ≤ arg1) is suppressed, the second suppression is added to the first:(r == arg1) ∧ (arg2 ≤ arg1) ⇒ r = max(arg1,arg2) (r == arg1) ∧ (arg2 == arg1) ⇒ r = max(arg1,arg2)
When (arg2 ≤ arg1) is suppressed, the second suppression for max will still suppress max. If (arg2 == arg1) is falsified, the (arg2 ≤ arg1) invariant will be created and can continue to suppress max (as long as it is not falsified itself).
-
swap
public NISuppressionSet swap()
Swaps each suppressor and suppressee to the opposite variable order. Valid only on unary and binary suppressors and suppressees.
-
get_suppressee
public NISuppressee get_suppressee()
Returns the suppressee.
-
clear_state
public void clear_state()
Clears the suppressor state in each suppression.
-
-