public @Override boolean equals(Object o) { Key k = (Key) o; return featureTypeRef.equals(k.featureTypeRef) && propertyName.equals(k.propertyName); }
/** * Constructs a new {@code DiffEntry} from two different {@link Node}s * * @param oldObject the old node ref * @param newObject the new node ref */ public DiffEntry(@Nullable NodeRef oldObject, @Nullable NodeRef newObject) { Preconditions.checkArgument(oldObject != null || newObject != null, "Either oldObject or newObject shall not be null"); if (oldObject != null && oldObject.equals(newObject)) { throw new IllegalArgumentException( "Trying to create a DiffEntry for the same object id, means the object didn't change: " + oldObject.toString()); } if (oldObject != null && newObject != null) { if (!oldObject.getType().equals(newObject.getType())) { String msg = String.format("Types don't match: %s : %s", oldObject.getType(), newObject.getType()); throw new IllegalArgumentException(msg); } } this.oldObject = oldObject; this.newObject = newObject; }
/** * Constructs a new {@code DiffEntry} from two different {@link Node}s * * @param oldObject the old node ref * @param newObject the new node ref */ public DiffEntry(@Nullable NodeRef oldObject, @Nullable NodeRef newObject) { Preconditions.checkArgument(oldObject != null || newObject != null, "Either oldObject or newObject shall not be null"); if (oldObject != null && oldObject.equals(newObject)) { throw new IllegalArgumentException( "Trying to create a DiffEntry for the same object id, means the object didn't change: " + oldObject.toString()); } if (oldObject != null && newObject != null) { if (!oldObject.getType().equals(newObject.getType())) { String msg = String.format("Types don't match: %s : %s", oldObject.getType(), newObject.getType()); throw new IllegalArgumentException(msg); } } this.oldObject = oldObject; this.newObject = newObject; }
@Test public void testIsEqual() { Node node = RevObjectFactory.defaultInstance().createNode("Points.1", ObjectId.valueOf("abc123000000000000001234567890abcdef0000"), ObjectId.NULL, TYPE.FEATURE, null, null); NodeRef nodeRef = new NodeRef(node, "Points", ObjectId.NULL); assertFalse(nodeRef.equals(node)); Node node2 = RevObjectFactory.defaultInstance().createNode("Lines.1", ObjectId.valueOf("abc123000000000000001234567890abcdef0001"), ObjectId.NULL, TYPE.FEATURE, null, null); NodeRef nodeRef2 = new NodeRef(node2, "Lines", ObjectId.NULL); NodeRef nodeRef3 = new NodeRef(node2, "Lines", ObjectId.valueOf("abc123000000000000001234567890abcdef0001")); assertFalse(nodeRef.equals(nodeRef2)); assertTrue(nodeRef.equals(nodeRef)); assertFalse(nodeRef2.equals(nodeRef3)); }
@Test public void testCompareTo() { Node node = RevObjectFactory.defaultInstance().createNode("Points.1", ObjectId.valueOf("abc123000000000000001234567890abcdef0000"), ObjectId.NULL, TYPE.FEATURE, null, null); NodeRef nodeRef = NodeRef.create("Points", node); assertFalse(nodeRef.equals(node)); Node node2 = RevObjectFactory.defaultInstance().createNode("Lines.1", ObjectId.valueOf("abc123000000000000001234567890abcdef0001"), ObjectId.NULL, TYPE.FEATURE, null, null); NodeRef nodeRef2 = new NodeRef(node2, "Lines", ObjectId.NULL); assertTrue(nodeRef.compareTo(nodeRef2) > 0); assertTrue(nodeRef2.compareTo(nodeRef) < 0); assertTrue(nodeRef.compareTo(nodeRef) == 0); }
if (theirsDiff.getNewObject().equals(oursDiff.getNewObject())) {
if (theirsDiff.getNewObject().equals(oursDiff.getNewObject())) {