public InvariantStatus add_modified(double[] a, int count) { // System.out.println ("common: " + ArraysMDE.toString (a)); if (a == null) { return InvariantStatus.FALSIFIED; } else if (intersect == null) { intersect = a; return InvariantStatus.NO_CHANGE; } else { double[] tmp = new double[intersect.length]; int size = 0; for (int i = 0; i < a.length; i++) { // if (a[i] in intersect) && !(a[i] in tmp), add a[i] to tmp int ii = Global.fuzzy.indexOf(intersect, a[i]); if ((ii != -1) && (Global.fuzzy.indexOf(ArraysMDE.subarray(tmp, 0, size), a[i]) == -1)) { // System.out.println ("adding " + intersect[ii] + " at " + size); // Carefully add the existing intersect value and not a[i]. These // are not necessarily the same when fuzzy floating point // comparisons are active. tmp[size++] = intersect[ii]; } } if (size == 0) { return InvariantStatus.FALSIFIED; } intersect = ArraysMDE.subarray(tmp, 0, size); } intersect = Intern.intern(intersect); elts++; return InvariantStatus.NO_CHANGE; }
public Derivation switchVars(VarInfo[] old_vars, VarInfo[] new_vars) { TernaryDerivation result = this.clone(); result.base1 = new_vars[ArraysMDE.indexOf(old_vars, result.base1)]; result.base2 = new_vars[ArraysMDE.indexOf(old_vars, result.base2)]; result.base3 = new_vars[ArraysMDE.indexOf(old_vars, result.base3)]; return result; }
public InvariantStatus check_modified(long[] a1, long[] a2, int count) { if ((a1 == null) || (a2 == null)) return InvariantStatus.FALSIFIED; int result = ArraysMDE.indexOf(a2, a1); if (result == -1) return InvariantStatus.FALSIFIED; else return InvariantStatus.NO_CHANGE; }