Package daikon.inv.binary.twoScalar
Class LinearBinaryCore
- Object
-
- LinearBinaryCore
-
- All Implemented Interfaces:
Serializable
,Cloneable
public final class LinearBinaryCore extends Object implements Serializable, Cloneable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description double
a
This invariant represents ax + by + c = 0; the first argument is x, second is y.double
b
This invariant represents ax + by + c = 0; the first argument is x, second is y.double
c
This invariant represents ax + by + c = 0; the first argument is x, second is y.static Logger
debug
Debug tracer.double
max_a
double
max_b
double
max_c
long
max_x
long
max_y
double
min_a
double
min_b
double
min_c
long
min_x
long
min_y
int
values_seen
Invariant
wrapper
long[]
x_cache
long[]
y_cache
-
Constructor Summary
Constructors Constructor Description LinearBinaryCore(Invariant wrapper)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InvariantStatus
add_modified(long x, long y, int count)
LinearBinaryCore
clone()
double
computeConfidence()
boolean
enoughSamples()
String
format_reversed_using(OutputFormat format, String xname, String yname)
static String
format_simplify(String str_x, String str_y, double a, double b, double c)
String
format_using(OutputFormat format, String xname, String yname)
String
format_using(OutputFormat format, String vix, String viy, double u, double v, double w)
static String
formatTerm(double coeff, @Nullable String varname, boolean first)
boolean
isActive()
Returns whether or not the invariant is currently active.boolean
isExclusiveFormula(LinearBinaryCore other)
boolean
isFlowable()
LinearBinary can't be flowed because it keeps samples to build the line.boolean
isSameFormula(LinearBinaryCore other)
@Nullable LinearBinaryCore
merge(List<LinearBinaryCore> cores, Invariant wrapper)
Merge the linear binary cores in cores to form a new core.boolean
mergeFormulasOk()
In general, we can't merge formulas, but we can merge invariants with too few samples to have formed a line with invariants with enough samples.String
repr()
void
swap()
-
-
-
Field Detail
-
a
public double a
This invariant represents ax + by + c = 0; the first argument is x, second is y.
-
b
public double b
This invariant represents ax + by + c = 0; the first argument is x, second is y.
-
c
public double c
This invariant represents ax + by + c = 0; the first argument is x, second is y.
-
min_x
public long min_x
-
min_y
public long min_y
-
max_x
public long max_x
-
max_y
public long max_y
-
min_a
public double min_a
-
max_a
public double max_a
-
min_b
public double min_b
-
max_b
public double max_b
-
min_c
public double min_c
-
max_c
public double max_c
-
values_seen
public int values_seen
-
x_cache
public long[] x_cache
-
y_cache
public long[] y_cache
-
-
Constructor Detail
-
LinearBinaryCore
public LinearBinaryCore(Invariant wrapper)
-
-
Method Detail
-
clone
@SideEffectFree public LinearBinaryCore clone(@GuardSatisfied LinearBinaryCore this)
-
swap
public void swap()
-
isActive
@Pure public boolean isActive()
Returns whether or not the invariant is currently active. We become active after MINPAIRS values have been seen and a line calculated. Before that, a and b are uninitialized.
-
isFlowable
@Pure public boolean isFlowable()
LinearBinary can't be flowed because it keeps samples to build the line. These sample can't be flowed from ppt to ppt (since they probably didn't occur at the lower ppt).
-
add_modified
public InvariantStatus add_modified(long x, long y, int count)
-
enoughSamples
public boolean enoughSamples(@GuardSatisfied LinearBinaryCore this)
-
computeConfidence
public double computeConfidence()
-
formatTerm
public static String formatTerm(double coeff, @Nullable String varname, boolean first)
-
format_using
@SideEffectFree public String format_using(OutputFormat format, String vix, String viy, double u, double v, double w)
-
format_simplify
public static String format_simplify(String str_x, String str_y, double a, double b, double c)
-
format_using
@SideEffectFree public String format_using(OutputFormat format, String xname, String yname)
-
format_reversed_using
public String format_reversed_using(OutputFormat format, String xname, String yname)
-
mergeFormulasOk
public boolean mergeFormulasOk()
In general, we can't merge formulas, but we can merge invariants with too few samples to have formed a line with invariants with enough samples. And those will appear to have different formulas.
-
merge
public @Nullable LinearBinaryCore merge(List<LinearBinaryCore> cores, Invariant wrapper)
Merge the linear binary cores in cores to form a new core. Any core in the list that has seen enough points to define a line, must define the same line. Any cores that have not yet seen enough points, will have each of their points applied to that invariant. The merged core is returned. Null is returned if the cores don't describe the same line- Parameters:
cores
- list of LinearBinary cores to merge. They should all be permuted to match the variable order in ppt.
-
isSameFormula
@Pure public boolean isSameFormula(LinearBinaryCore other)
-
isExclusiveFormula
@Pure public boolean isExclusiveFormula(LinearBinaryCore other)
-
-