public AstNode<?> getA() { return (AstNode<?>) super.getA(); }
public AstNode<?> getB() { return (AstNode<?>) super.getB(); }
@Override public String toString() { try { return toString(new StringWriter()).toString(); } catch (IOException e) { e.printStackTrace(); return null; } } }
public void compare(Object a, Object b) throws ComparisonException { if (a == b) return; if ((a == null) != (b == null)) throw new ComparisonException(a, b); int size = delegates.size(); for (int i = 0; i < size; ++i) { DeepComparerDelegate delegate = delegates.get(i); if (delegate.compare(a, b, this)) return; } if (!a.equals(b)) { a.equals(b); throw new ComparisonException(a, b); } }
protected Writer toString(Writer w) throws IOException if ((getA() != null) != (getB() != null)) if (getA() != null) getObjectDesc(getA()))); getObjectDesc(getB()))); else if (getA().getClass() != getB().getClass()) getA().getClass().getName(), getB().getClass().getName())); getObjectDesc(getA())));
@Override public boolean compare(Object _a, Object _b, DeepComparer comparer) throws ComparisonException { if (!((_a instanceof Collection) && (_b instanceof Collection))) return false; Collection<?> a = (Collection<?>) _a; Collection<?> b = (Collection<?>) _b; Iterator<?> e1 = a.iterator(); Iterator<?> e2 = b.iterator(); while (e1.hasNext() && e2.hasNext()) { Object o1 = e1.next(); Object o2 = e2.next(); if ((o1 == null) != (o2 == null)) throw new ComparisonException(a, b); comparer.compare(o1, o2); } if (e1.hasNext() || e2.hasNext()) throw new ComparisonException(a, b); return true; } }
@Override public boolean compare(Object a, Object b, DeepComparer comparer) throws ComparisonException { if (emptyImmutables.contains(a)) { if (!((WtEmptyContentNode) a).equals(b)) throw new ComparisonException(a, b); return true; } else if (emptyImmutables.contains(b)) { if (((WtEmptyContentNode) b).equals(a)) throw new ComparisonException(a, b); return true; } else return false; } }
@Override public boolean compare(Object a, Object b, DeepComparer comparer) throws ComparisonException { if (emptyImmutables.contains(a)) { if (!((WtEmptyContentNode) a).equals(b)) throw new ComparisonException(a, b); return true; } else if (emptyImmutables.contains(b)) { if (((WtEmptyContentNode) b).equals(a)) throw new ComparisonException(a, b); return true; } else return false; } }
@Override public boolean compare(Object _a, Object _b, DeepComparer comparer) throws ComparisonException { if (!((_a instanceof Map) && (_b instanceof Map))) return false; Map<?, ?> a = (Map<?, ?>) _a; Map<?, ?> b = (Map<?, ?>) _b; if (b.size() != a.size()) throw new ComparisonException(a, b); Iterator<?> i = a.entrySet().iterator(); while (i.hasNext()) { Entry<?, ?> e = (Entry<?, ?>) i.next(); Object key = e.getKey(); Object value = e.getValue(); if (value == null) { if (!(b.get(key) == null && b.containsKey(key))) throw new ComparisonException(a, b); } else { comparer.compare(value, b.get(key)); } } return true; } }
throw new ComparisonException(a, b); throw new ComparisonException(a, b);
@Override public boolean compare(Object _a, Object _b, DeepComparer comparer) throws ComparisonException { if (!(_a instanceof AstEntityMap)) return false; if (!(_b instanceof AstEntityMap)) throw new ComparisonException(_a, _b); AstEntityMap<?> a = (AstEntityMap<?>) _a; AstEntityMap<?> b = (AstEntityMap<?>) _b; comparer.compare(a.getMap(), b.getMap()); return true; } }