Package daikon.inv.unary.sequence
Class EltRangeInt.PowerOfTwo
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Enclosing class:
- EltRangeInt
public static class EltRangeInt.PowerOfTwo extends EltRangeInt
Invariant representing longs whose values are always a power of 2 (exactly one bit is set). Used for non-instantiating suppressions. Since this is not covered by the Bound or OneOf invariants it is printed. Prints asx is a power of 2
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class EltRangeInt
EltRangeInt.BooleanVal, EltRangeInt.Bound0_63, EltRangeInt.EqualMinusOne, EltRangeInt.EqualOne, EltRangeInt.EqualZero, EltRangeInt.Even, EltRangeInt.GreaterEqual64, EltRangeInt.GreaterEqualZero, EltRangeInt.PowerOfTwo
-
Nested classes/interfaces inherited from class Invariant
Invariant.ClassVarnameComparator, Invariant.ClassVarnameFormulaComparator, Invariant.InvariantComparatorForPrinting, Invariant.Match
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
dkconfig_enabled
Boolean.-
Fields inherited from class SingleSequence
dkconfig_SeqIndexDisableAll
-
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
PowerOfTwo()
protected
PowerOfTwo(PptSlice ppt)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
enabled()
returns whether or not this invariant is enabledboolean
eq_check(long x)
Returns true if x is a power of 2 (has one bit on).String
get_format_str(OutputFormat format)
Return a format string for the specified output format.static EltRangeInt.PowerOfTwo
get_proto()
returns the prototype invariantEltRangeInt.PowerOfTwo
instantiate_dyn(PptSlice slice)
instantiates the invariant on the specified slice@Nullable DiscardInfo
isObviousDynamically(VarInfo[] vis)
Since PowerOfTwo is not covered by Bound or OneOf, it is not obvious (and should thus be printed).-
Methods inherited from class EltRangeInt
add_modified, check_modified, computeConfidence, find_oneof, format_using, get_proto_all, instantiate_ok, isExclusiveFormula, isSameFormula
-
Methods inherited from class SingleScalarSequence
add, add_unmodified, check, check_unmodified, valid_types, valid_types_static, var
-
Methods inherited from class UnaryInvariant
resurrect_done
-
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, is_false, is_ni_suppressed, isActive, isAllPrestate, isEqualityComparison, isExact, isObvious, 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
-
dkconfig_enabled
public static boolean dkconfig_enabled
Boolean. True if PowerOfTwo invariants should be considered.
-
-
Constructor Detail
-
PowerOfTwo
protected PowerOfTwo(PptSlice ppt)
-
PowerOfTwo
protected PowerOfTwo()
-
-
Method Detail
-
get_proto
public static EltRangeInt.PowerOfTwo get_proto()
returns the prototype invariant
-
enabled
public boolean enabled()
returns whether or not this invariant is enabled
-
instantiate_dyn
public EltRangeInt.PowerOfTwo instantiate_dyn( EltRangeInt.PowerOfTwo this, PptSlice slice)
instantiates the invariant on the specified slice- Specified by:
instantiate_dyn
in classInvariant
- Returns:
- the new invariant
-
get_format_str
public String get_format_str(@GuardSatisfied EltRangeInt.PowerOfTwo this, OutputFormat format)
Description copied from class:EltRangeInt
Return a format string for the specified output format. Each instance of %varN% will be replaced by the correct name for varN.- Specified by:
get_format_str
in classEltRangeInt
-
eq_check
public boolean eq_check(long x)
Returns true if x is a power of 2 (has one bit on). The check is to and x with itself - 1. The theory is that if there are multiple bits turned on, at least one of those bits is unmodified by a subtract operation and thus the bitwise-and be non-zero. There is probably a more elegant way to do this.- Specified by:
eq_check
in classEltRangeInt
-
isObviousDynamically
@Pure public @Nullable DiscardInfo isObviousDynamically(VarInfo[] vis)
Since PowerOfTwo is not covered by Bound or OneOf, it is not obvious (and should thus be printed).- Overrides:
isObviousDynamically
in classEltRangeInt
-
-