public boolean evaluate( Object locationA, Object locationB ) { Location location1 = (Location)locationA; Location location2 = (Location)locationB; return location1 != null && location1.isSame(location2); } };
protected ProxyNode( Projection projection, Location locationInSource, Location locationInFederated ) { super(locationInSource); this.projection = projection; this.federatedLocation = locationInFederated; this.sameLocationAsOriginal = locationInSource.isSame(locationInFederated); }
public boolean evaluate( Object locationA, Object locationB ) { Location location1 = (Location)locationA; Location location2 = (Location)locationB; return location1 != null && location1.isSame(location2); } };
public boolean isSameNode( NetChange that ) { if (that == this) return true; if (this.hc != that.hc) return false; if (!this.workspaceName.equals(that.workspaceName)) return false; if (!this.location.isSame(that.location)) return false; return true; }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.location.isSame(that.getLocation()); } return false; }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.location.isSame(that.getLocation()); } return false; }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.getLocation().isSame(that.getLocation()); } return false; }
protected final boolean isSameTuple( Columns columns, Object[] tuple1, Object[] tuple2 ) { for (int i = columns.getColumnCount(); i != columns.getLocationCount(); ++i) { Location location = (Location)tuple1[i]; Location location2 = (Location)tuple2[i]; if (!location.isSame(location2)) return false; } return true; } }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals( Object obj ) { if (obj == this) return true; if (this.getClass().isInstance(obj)) { DeleteChildrenRequest that = (DeleteChildrenRequest)obj; if (!this.at().isSame(that.at())) return false; if (!this.inWorkspace().equals(that.inWorkspace())) return false; return true; } return false; }
@Test public void locationsWithSamePathsAreSame() { Location locationA1 = Location.create(pathA); Location locationA2 = Location.create(pathA); assertThat("isSame must return true for locations created with identical paths", locationA1.isSame(locationA2), is(true)); Location locationABC1 = Location.create(pathABC); Location locationABC2 = Location.create(pathABC); assertThat("isSame must return true for locations created with identical, non-trivial paths", locationABC1.isSame(locationABC2), is(true)); }
@Test public void locationsWithSamePathsAndDifferentPropertiesAreNotSame() { Location locationA1 = Location.create(pathA, propListAB); Location locationA2 = Location.create(pathA, propListABU); assertThat("isSame must not return true for locations created with identical paths and different properties", locationA1.isSame(locationA2), is(false)); }
@Test public void locationsWithSamePathsAndDifferentPropertyAreNotSame() { Location locationA1 = Location.create(pathA, propA); Location locationA2 = Location.create(pathA, propB); assertThat("isSame must not return true for locations created with identical paths and property", locationA1.isSame(locationA2), is(false)); }
@Test public void locationsWithSamePathsAndSamePropertyAreNotSame() { Location locationA1 = Location.create(pathA, propA); Location locationA2 = Location.create(pathA, propA); assertThat("isSame must return true for locations created with identical paths and property", locationA1.isSame(locationA2), is(true)); }
@Test public void locationsWithDifferentPathsAndSamePropertyAreNotSame() { Location locationA1 = Location.create(pathA, propA); Location locationA2 = Location.create(pathABC, propA); assertThat("isSame must not return true for locations created with different paths and the same property", locationA1.isSame(locationA2), is(false)); }
@Test public void locationsWithDifferentPathsAndSamePropertiesAreNotSame() { Location locationA1 = Location.create(pathA, propListAB); Location locationA2 = Location.create(pathABC, propListAB); assertThat("isSame must not return true for locations created with different paths and the same properties", locationA1.isSame(locationA2), is(false)); }
@Test public void locationsWithSamePathsAndSamePropertiesAreNotSame() { Location locationA1 = Location.create(pathA, propListAB); Location locationA2 = Location.create(pathA, propListAB); assertThat("isSame must return true for locations created with identical paths and properties", locationA1.isSame(locationA2), is(true)); }
@Test public void testTransitivityOfWithOperationForPathAndProperty() { Location locationA1 = Location.create(pathA); locationA1 = locationA1.with(propB); Location locationU1 = Location.create(propB); locationU1 = locationU1.with(pathA); assertThat("With() operation must be transitive for equals", locationA1.equals(locationU1), is(true)); assertThat("With() operation must be transitive for isSame", locationA1.isSame(locationU1), is(true)); assertThat("With() operation must be transitive for getString", locationA1.getString().equals(locationU1.getString()), is(true)); assertThat("With() operation must be transitive for hashCode", locationA1.hashCode() == locationU1.hashCode(), is(true)); }
@Test public void testTransitivityOfWithOperationForPathAndUUID() { Location locationA1 = Location.create(pathA); locationA1 = locationA1.with(uuid); Location locationU1 = Location.create(uuid); locationU1 = locationU1.with(pathA); assertThat("With() operation must be transitive for equals", locationA1.equals(locationU1), is(true)); assertThat("With() operation must be transitive for isSame", locationA1.isSame(locationU1), is(true)); assertThat("With() operation must be transitive for getString", locationA1.getString().equals(locationU1.getString()), is(true)); assertThat("With() operation must be transitive for hashCode", locationA1.hashCode() == locationU1.hashCode(), is(true)); }
@Test public void shouldReturnEquivalentLocationForRootUponRepeatedCalls() { Node root = graph.getNodeAt("/"); for (int i = 0; i != 10; ++i) { Node anotherRoot = graph.getNodeAt("/"); assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true)); assertThat(anotherRoot.getLocation().getPath(), is(root.getLocation().getPath())); assertThat(anotherRoot.getLocation().getIdProperties(), is(root.getLocation().getIdProperties())); } }
@Test public void shouldFindRootByUUID() { Node root = graph.getNodeAt("/"); Location rootLocation = root.getLocation(); UUID uuid = rootLocation.getUuid(); if (uuid != null) { // Find the root node using the identification properties ... Node anotherRoot = graph.getNodeAt(uuid); assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true)); assertThat(anotherRoot.getLocation().getPath(), is(root.getLocation().getPath())); assertThat(anotherRoot.getLocation().getIdProperties(), is(root.getLocation().getIdProperties())); assertThat(anotherRoot.getLocation().getUuid(), is(root.getLocation().getUuid())); } }