public List<Difference> diff(DiffValue master, DiffValue test) { if (master.getValue().equals(test.getValue())) { return Collections.emptyList(); } else { return Arrays.asList(new Difference(master.getBinding(), test.getBinding())); } }
public List<Difference> diff(DiffElement master, DiffElement test) { DiffValue masterValue = master.getValue(); DiffValue testValue = test.getValue(); if (masterValue.isCompound() && masterValue.isCompound()) { return diff(master.getValueAsNode(), test.getValueAsNode()); } else if (masterValue.isAtomic() && testValue.isAtomic()) { return diff(masterValue, testValue); } else { // structural difference in types. one is node, other is leaf return Arrays.asList(new Difference(master, test)); } }