Class DummyInvariant
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class DummyInvariant extends Invariant
This is a special invariant used internally by Daikon to represent invariants whose meaning Daikon doesn't understand. The only operation that can be performed on a DummyInvariant is to print it. In particular, the invariant cannot be tested against a sample: the invariant is always assumed to hold and is always considered to be statistically justified.The main use for a dummy invariant is to represent a splitting condition that appears in a
.spinfo
file. The.spinfo
file can indicate an arbitrary Java expression, which might not be equivalent to any invariant in Daikon's grammar.Ordinarily, Daikon uses splitting conditions to split data, then seeks to use that split data to form conditional invariants out of its standard built-in invariants. If you wish the expression in the .spinfo file to be printed as an invariant, whether or not it is itself discovered by Daikon during invariant detection, then the configuration option
daikon.split.PptSplitter.dummy_invariant_level
must be set, and formatting information must be supplied in the splitter info file.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class Invariant
Invariant.ClassVarnameComparator, Invariant.ClassVarnameFormulaComparator, Invariant.InvariantComparatorForPrinting, Invariant.Match
-
-
Field Summary
Fields Modifier and Type Field Description boolean
valid
-
Fields inherited from class Invariant
CONFIDENCE_JUSTIFIED, CONFIDENCE_NEVER, CONFIDENCE_UNJUSTIFIED, debug, debugFlow, debugGuarding, debugIsObvious, debugIsWorthPrinting, debugPrint, debugPrintEquality, dkconfig_confidence_limit, dkconfig_fuzzy_ratio, dkconfig_simplify_define_predicates, falsified, invariantEnabledDefault, isGuardingPredicate, min_mod_non_missing_samples, ppt, PROBABILITY_JUSTIFIED, PROBABILITY_NEVER, PROBABILITY_UNJUSTIFIED
-
-
Constructor Summary
Constructors Constructor Description DummyInvariant(@Nullable String daikonStr, @Nullable String java, @Nullable String esc, @Nullable String simplify, @Nullable String jml, @Nullable String dbc, @Nullable String csharp, boolean valid)
DummyInvariant(PptSlice ppt, @Nullable String daikonStr, @Nullable String java, @Nullable String esc, @Nullable String simplify, @Nullable String jml, @Nullable String dbc, @Nullable String csharp, boolean valid)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
computeConfidence()
This method computes the confidence that this invariant occurred by chance.boolean
enabled()
Returns whether or not this class of invariants is currently enabled.String
format_csharp()
String
format_daikon()
String
format_dbc()
String
format_esc()
String
format_java()
String
format_jml()
String
format_simplify()
String
format_using(OutputFormat format)
Return a printed representation of this invariant, in the given format.DummyInvariant
instantiate(PptTopLevel parent, VarInfo[] vars)
protected DummyInvariant
instantiate_dyn(PptSlice slice)
Instantiates (creates) an invariant of the same class on the specified slice.boolean
isSameFormula(Invariant other)
Returns true iff the two invariants represent the same mathematical formula.void
negate()
protected Invariant
resurrect_done(int[] permutation)
Called on the new invariant just before resurrect() returns it to allow subclasses to fix any information they might have cached from the old Ppt and VarInfos.boolean
valid_types(VarInfo[] vis)
Returns whether or not the invariant is valid over the basic types in vis.-
Methods inherited from class Invariant
add_sample, asInvClass, checkRep, clear_falsified, clone, clone_and_permute, conf_is_ge, confidence_and, confidence_and, confidence_or, createGuardedInvariant, createGuardingPredicate, enoughSamples, falsify, find, format, format_classname, format_too_few_samples, format_unimplemented, formatFuzzy, get_comparability, get_ni_suppressions, getConfidence, getGuardingList, getGuardingList, hasUninterestingConstant, instantiate, instantiate_ok, is_false, is_ni_suppressed, isActive, isAllPrestate, isEqualityComparison, isExact, isExclusiveFormula, isObvious, isObviousDynamically, isObviousDynamically, isObviousDynamically_SomeInEquality, isObviousDynamically_SomeInEqualityHelper, isObviousStatically, isObviousStatically, isObviousStatically_AllInEquality, isObviousStatically_SomeInEquality, isObviousStatically_SomeInEqualityHelper, isReflexive, isSameInvariant, isValidEscExpression, isValidExpression, isWorthPrinting, justified, log, log, logDetail, logOn, match, merge, mergeFormulasOk, permute, prob_and, prob_and, prob_is_ge, prob_or, repCheck, repr, repr_prob, resurrect, simplify_format_double, simplify_format_long, simplify_format_string, state_match, toString, toString, transfer, usesVar, usesVar, usesVarDerived, varNames
-
-
-
-
Field Detail
-
valid
public boolean valid
-
-
Method Detail
-
instantiate
public DummyInvariant instantiate(PptTopLevel parent, VarInfo[] vars)
-
computeConfidence
protected double computeConfidence()
Description copied from class:Invariant
This method computes the confidence that this invariant occurred by chance. Clients should callInvariant.getConfidence()
instead.This method need not check the value of field "falsified", as the caller does that.
- Specified by:
computeConfidence
in classInvariant
- Returns:
- confidence of this invariant
- See Also:
Invariant.getConfidence()
-
negate
public void negate()
-
format_using
@SideEffectFree public String format_using(@GuardSatisfied DummyInvariant this, OutputFormat format)
Description copied from class:Invariant
Return a printed representation of this invariant, in the given format.- Specified by:
format_using
in classInvariant
-
format_daikon
public String format_daikon(@GuardSatisfied DummyInvariant this)
-
format_java
public String format_java(@GuardSatisfied DummyInvariant this)
-
format_esc
public String format_esc(@GuardSatisfied DummyInvariant this)
-
format_simplify
public String format_simplify(@GuardSatisfied DummyInvariant this)
-
format_jml
public String format_jml(@GuardSatisfied DummyInvariant this)
-
format_dbc
public String format_dbc(@GuardSatisfied DummyInvariant this)
-
format_csharp
public String format_csharp(@GuardSatisfied DummyInvariant this)
-
resurrect_done
protected Invariant resurrect_done(int[] permutation)
Description copied from class:Invariant
Called on the new invariant just before resurrect() returns it to allow subclasses to fix any information they might have cached from the old Ppt and VarInfos.- Specified by:
resurrect_done
in classInvariant
- Parameters:
permutation
- the permutation- Returns:
- the permuted invariant
-
isSameFormula
public boolean isSameFormula(Invariant other)
Description copied from class:Invariant
Returns true iff the two invariants represent the same mathematical formula. Does not consider the context such as variable names, confidences, sample counts, value counts, or related quantities. As a rule of thumb, if two invariants format the same, this method returns true. Furthermore, in many cases, if an invariant does not involve computed constants (as "x>c" and "y=ax+b" do for constants a, b, and c), then this method vacuously returns true.- Specified by:
isSameFormula
in classInvariant
- Parameters:
other
- the invariant to compare to this one- Returns:
- true iff the two invariants represent the same mathematical formula. Does not consider
-
enabled
public boolean enabled( DummyInvariant this)
Description copied from class:Invariant
Returns whether or not this class of invariants is currently enabled.Its implementation is almost always
return dkconfig_enabled;
.
-
valid_types
public boolean valid_types( DummyInvariant this, VarInfo[] vis)
Description copied from class:Invariant
Returns whether or not the invariant is valid over the basic types in vis. This only checks basic types (scalar, string, array, etc) and should match the basic superclasses of invariant (SingleFloat, SingleScalarSequence, ThreeScalar, etc). More complex checks that depend on variable details can be implemented in instantiate_ok().- Specified by:
valid_types
in classInvariant
- See Also:
Invariant.instantiate_ok(VarInfo[])
-
instantiate_dyn
protected DummyInvariant instantiate_dyn( DummyInvariant this, PptSlice slice)
Description copied from class:Invariant
Instantiates (creates) an invariant of the same class on the specified slice. Must be overridden in each class. Must be used rather thanInvariant.clone()
so that checks inInvariant.instantiate(daikon.PptSlice)
for reasonable invariants are done.The implementation of this method is almost always
return new <em>InvName</em>(slice);
- Specified by:
instantiate_dyn
in classInvariant
- Returns:
- the new invariant
-
-