/** * {@inheritDoc} */ @Override public boolean isDetectedBy(Assertion assertion) { if (assertion instanceof EqualsAssertion) { EqualsAssertion ass = (EqualsAssertion) assertion; if (ass.source.equals(var) && equalityMap.containsKey(ass.dest)) { return !equals(equalityMap.get(ass.dest), ass.value); } } return false; }
/** * {@inheritDoc} */ @Override public OutputTraceEntry cloneEntry() { ComparisonTraceEntry copy = new ComparisonTraceEntry(var); copy.equalityMap.putAll(equalityMap); copy.equalityMapIntVar.putAll(equalityMapIntVar); return copy; }
return; ComparisonTraceEntry entry = new ComparisonTraceEntry(var); int position = statement.getPosition(); logger.debug("Comparison of " + var + " with " + other + " is: " + object.equals(otherObject)); entry.addEntry(other, ComparisonTraceEntry.equals(object, otherObject)); } catch (Throwable t) { logger.debug("Exception during equals: " + t);
/** * {@inheritDoc} */ @Override public boolean differs(OutputTraceEntry other) { if (other instanceof ComparisonTraceEntry) { if (!((ComparisonTraceEntry) other).var.equals(var)) { return false; } ComparisonTraceEntry otherEntry = (ComparisonTraceEntry) other; for (VariableReference otherVar : equalityMap.keySet()) { if (!otherEntry.equalityMap.containsKey(otherVar)) { continue; } if (!equals(otherEntry.equalityMap.get(otherVar), equalityMap.get(otherVar))) { return true; } } } return false; }
continue; if (!equals(otherEntry.equalityMap.get(otherEntry.equalityMapIntVar.get(otherVar)), equalityMap.get(equalityMapIntVar.get(otherVar)))) {
/** {@inheritDoc} */ @Override public boolean evaluate(Scope scope) { try { if (((Boolean) value).booleanValue()) { if (source.getObject(scope) == null) return dest.getObject(scope) == null; else return ComparisonTraceEntry.equals(source.getObject(scope), dest.getObject(scope)); } else { if (source.getObject(scope) == null) return dest.getObject(scope) != null; else return !ComparisonTraceEntry.equals(source.getObject(scope), dest.getObject(scope)); } } catch (CodeUnderTestException e) { throw new UnsupportedOperationException(); } }