Package daikon.inv.unary.scalar
Class SingleScalar
- Object
-
- Invariant
-
- UnaryInvariant
-
- SingleScalar
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
CompleteOneOfScalar
,IsPointer
,LowerBound
,Modulus
,NonModulus
,NonZero
,OneOfScalar
,Positive
,RangeInt
,UpperBound
public abstract class SingleScalar extends UnaryInvariant
Abstract base class for invariants over one numeric (scalar) variable, such asx != 0
.- 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 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 Modifier Constructor Description protected
SingleScalar()
protected
SingleScalar(PptSlice ppt)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description InvariantStatus
add(@Interned Object val, int mod_index, int count)
abstract InvariantStatus
add_modified(long value, int count)
Similar tocheck_modified(long, int)
except that it can change the state of the invariant if necessary.InvariantStatus
add_unmodified(long value, int count)
By default, do nothing if the value hasn't been seen yet.InvariantStatus
check(@Interned Object val, int mod_index, int count)
abstract InvariantStatus
check_modified(long value, int count)
Presents a sample to the invariant.InvariantStatus
check_unmodified(long value, int count)
boolean
valid_types(VarInfo[] vis)
Returns whether or not the specified types are valid for unary scalar.static boolean
valid_types_static(VarInfo[] vis)
Returns whether or not the specified types are valid for unary scalar.VarInfo
var()
-
Methods inherited from class UnaryInvariant
resurrect_done
-
Methods inherited from class Invariant
add_sample, asInvClass, checkRep, clear_falsified, clone, clone_and_permute, computeConfidence, conf_is_ge, confidence_and, confidence_and, confidence_or, createGuardedInvariant, createGuardingPredicate, enabled, enoughSamples, falsify, find, format, format_classname, format_too_few_samples, format_unimplemented, format_using, formatFuzzy, get_comparability, get_ni_suppressions, getConfidence, getGuardingList, getGuardingList, hasUninterestingConstant, instantiate, instantiate_dyn, 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, isSameFormula, 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
-
-
-
-
Constructor Detail
-
SingleScalar
protected SingleScalar(PptSlice ppt)
-
SingleScalar
protected SingleScalar()
-
-
Method Detail
-
var
public VarInfo var(@GuardSatisfied @UnknownInitialization(SingleScalar.class) SingleScalar this)
-
valid_types_static
public static final boolean valid_types_static(VarInfo[] vis)
Returns whether or not the specified types are valid for unary scalar. (Static version of method.)
-
valid_types
public final boolean valid_types(VarInfo[] vis)
Returns whether or not the specified types are valid for unary scalar.- Specified by:
valid_types
in classInvariant
- See Also:
Invariant.instantiate_ok(VarInfo[])
-
add
public InvariantStatus add(@Interned Object val, int mod_index, int count)
- Specified by:
add
in classUnaryInvariant
-
check
public InvariantStatus check(@Interned Object val, int mod_index, int count)
- Specified by:
check
in classUnaryInvariant
-
add_modified
public abstract InvariantStatus add_modified(long value, int count)
Similar tocheck_modified(long, int)
except that it can change the state of the invariant if necessary. If the invariant doesn't have any state, then the implementation should simply callcheck_modified(long, int)
. This method need not check for falsification; that is done by the caller.
-
add_unmodified
public InvariantStatus add_unmodified(long value, int count)
By default, do nothing if the value hasn't been seen yet. Subclasses can override this.
-
check_modified
public abstract InvariantStatus check_modified(long value, int count)
Presents a sample to the invariant. Returns whether the sample is consistent with the invariant. Does not change the state of the invariant.- Parameters:
count
- how many identical samples were observed in a row. For example, three calls to check_modified with a count parameter of 1 is equivalent to one call to check_modified with a count parameter of 3.- Returns:
- whether or not the sample is consistent with the invariant
-
check_unmodified
public InvariantStatus check_unmodified(long value, int count)
-
-