Package daikon.test.diff
Class DiffDummyInvariant
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class DiffDummyInvariant extends Invariant
A dummy invariant used for testing purposes.- 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 double
confidence
The confidence fro this dummy invariant.String
formula
A string representation of the formula that this dummy invariant represents.boolean
isWorthPrinting
Whether the invariant is worth printing.-
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 DiffDummyInvariant(PptSlice ppt, String formula, boolean justified)
Create an instance of DiffDummyInvariant.DiffDummyInvariant(PptSlice ppt, String formula, boolean justified, boolean isWorthPrinting)
Create an instance of DiffDummyInvariant.DiffDummyInvariant(PptSlice ppt, String formula, double confidence)
Create an instance of DiffDummyInvariant.DiffDummyInvariant(PptSlice ppt, String formula, double confidence, boolean isWorthPrinting)
Create an instance of DiffDummyInvariant.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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_using(OutputFormat format)
Return a printed representation of this invariant, in the given format.protected DiffDummyInvariant
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.boolean
isSameInvariant(Invariant other)
Returns true iff the argument is the "same" invariant as this.boolean
isWorthPrinting()
String
repr()
For printing invariants, there are two interfaces: repr gives a low-level representation (Invariant.repr_prob()
also prints the confidence), andInvariant.format()
gives a high-level representation for user output.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, isValidEscExpression, isValidExpression, justified, log, log, logDetail, logOn, match, merge, mergeFormulasOk, permute, prob_and, prob_and, prob_is_ge, prob_or, repCheck, repr_prob, resurrect, simplify_format_double, simplify_format_long, simplify_format_string, state_match, toString, toString, transfer, usesVar, usesVar, usesVarDerived, varNames
-
-
-
-
Field Detail
-
formula
public String formula
A string representation of the formula that this dummy invariant represents.
-
confidence
public double confidence
The confidence fro this dummy invariant.
-
isWorthPrinting
public boolean isWorthPrinting
Whether the invariant is worth printing.
-
-
Constructor Detail
-
DiffDummyInvariant
public DiffDummyInvariant(PptSlice ppt, String formula, boolean justified)
Create an instance of DiffDummyInvariant.
-
DiffDummyInvariant
public DiffDummyInvariant(PptSlice ppt, String formula, boolean justified, boolean isWorthPrinting)
Create an instance of DiffDummyInvariant.
-
DiffDummyInvariant
public DiffDummyInvariant(PptSlice ppt, String formula, double confidence)
Create an instance of DiffDummyInvariant.
-
DiffDummyInvariant
public DiffDummyInvariant(PptSlice ppt, String formula, double confidence, boolean isWorthPrinting)
Create an instance of DiffDummyInvariant.
-
-
Method Detail
-
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
-
isSameInvariant
@Pure public boolean isSameInvariant(Invariant other)
Description copied from class:Invariant
Returns true iff the argument is the "same" invariant as this. Same, in this case, means a matching type, formula, and variable names.- Overrides:
isSameInvariant
in classInvariant
- Parameters:
other
- the other invariant to compare to this one- Returns:
- true iff the argument is the "same" invariant as this
-
isSameFormula
@Pure 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
-
computeConfidence
public 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()
-
repr
public String repr(@GuardSatisfied DiffDummyInvariant this)
Description copied from class:Invariant
For printing invariants, there are two interfaces: repr gives a low-level representation (Invariant.repr_prob()
also prints the confidence), andInvariant.format()
gives a high-level representation for user output.
-
format_using
@SideEffectFree public String format_using(@GuardSatisfied DiffDummyInvariant 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
-
isWorthPrinting
@Pure public boolean isWorthPrinting()
- Overrides:
isWorthPrinting
in classInvariant
-
enabled
public boolean enabled()
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(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 DiffDummyInvariant instantiate_dyn(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
-
-