本文整理了Java中org.locationtech.geogig.model.Node.equals()
方法的一些代码示例,展示了Node.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.equals()
方法的具体详情如下:
包路径:org.locationtech.geogig.model.Node
类名称:Node
方法名:equals
[英]Equality check based on #getName(), #getType(), and #getObjectId(); #getMetadataId() is NOT part of the equality check.
[中]基于#getName()、#getType()和#getObjectId()的相等性检查#getMetadataId()不是等式检查的一部分。
代码示例来源:origin: locationtech/geogig
@Override
public boolean equals(Object o) {
if (!(o instanceof DirectDAGNode)) {
return false;
}
return node.equals(((DirectDAGNode) o).node);
}
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Override
public boolean equals(Object o) {
if (!(o instanceof DirectDAGNode)) {
return false;
}
return node.equals(((DirectDAGNode) o).node);
}
}
代码示例来源:origin: locationtech/geogig
/**
* Overrides to only call {@link #put(Node) put(newNode)} since both old and new are guaranteed
* to fall on the same bucket as mandated by the canonical node order.
*/
@Override
public int update(Node oldNode, Node newNode) {
Preconditions.checkArgument(oldNode.getName().equals(newNode.getName()));
int delta = put(newNode);
if (delta == 0 && !oldNode.equals(newNode)) {
delta = 1;
}
return delta;
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
/**
* Overrides to only call {@link #put(Node) put(newNode)} since both old and new are guaranteed
* to fall on the same bucket as mandated by the canonical node order.
*/
@Override
public int update(Node oldNode, Node newNode) {
Preconditions.checkArgument(oldNode.getName().equals(newNode.getName()));
int delta = put(newNode);
if (delta == 0 && !oldNode.equals(newNode)) {
delta = 1;
}
return delta;
}
代码示例来源:origin: locationtech/geogig
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof MutableTree)) {
return false;
}
MutableTree other = (MutableTree) o;
return node.equals(other.node) && node.getMetadataId().equals(other.node.getMetadataId())
&& childTrees.equals(other.childTrees);
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof MutableTree)) {
return false;
}
MutableTree other = (MutableTree) o;
return node.equals(other.node) && node.getMetadataId().equals(other.node.getMetadataId())
&& childTrees.equals(other.childTrees);
}
代码示例来源:origin: locationtech/geogig
/**
* Tests equality over another {@code NodeRef} based on {@link #getParentPath() parent path},
* {@link #getNode() node} name and id, and {@link #getMetadataId()}
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof NodeRef)) {
return false;
}
NodeRef r = (NodeRef) o;
return Objects.equal(parentPath, r.parentPath) && node.equals(r.node)
&& getMetadataId().equals(r.getMetadataId());
}
代码示例来源:origin: org.locationtech.geogig/geogig-api
/**
* Tests equality over another {@code NodeRef} based on {@link #getParentPath() parent path},
* {@link #getNode() node} name and id, and {@link #getMetadataId()}
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof NodeRef)) {
return false;
}
NodeRef r = (NodeRef) o;
return Objects.equal(parentPath, r.parentPath) && node.equals(r.node)
&& getMetadataId().equals(r.getMetadataId());
}
代码示例来源:origin: locationtech/geogig
if (!left.equals(right)) {
checkState(updated, "Node %s was not updated to %s", left, right);
代码示例来源:origin: org.locationtech.geogig/geogig-core
if (!left.equals(right)) {
checkState(updated, "Node %s was not updated to %s", left, right);
代码示例来源:origin: org.locationtech.geogig/geogig-core
@Override
public boolean feature(final @Nullable NodeRef left, @Nullable final NodeRef right) {
final boolean cancelled = progress.isCanceled();
if (!cancelled) {
if (left == null) {
Node node = right.getNode();
boolean put = builder.put(node);
checkState(put, "Node was not added to index: %s", node);
} else if (right == null) {
Node node = left.getNode();
boolean removed = builder.remove(node);
checkState(removed, "Node was not removed from index: %s", node);
} else {
Node lnode = left.getNode();
Node rnode = right.getNode();
boolean updated = builder.update(lnode, rnode);
if (!lnode.equals(rnode)) {
checkState(updated, "Node %s was not updated to %s", lnode, rnode);
}
}
progress.setProgress(count.incrementAndGet());
}
return !cancelled;
}
代码示例来源:origin: locationtech/geogig
@Override
public boolean feature(final @Nullable NodeRef left, @Nullable final NodeRef right) {
final boolean cancelled = progress.isCanceled();
if (!cancelled) {
if (left == null) {
Node node = right.getNode();
boolean put = builder.put(node);
checkState(put, "Node was not added to index: %s", node);
} else if (right == null) {
Node node = left.getNode();
boolean removed = builder.remove(node);
checkState(removed, "Node was not removed from index: %s", node);
} else {
Node lnode = left.getNode();
Node rnode = right.getNode();
boolean updated = builder.update(lnode, rnode);
if (!lnode.equals(rnode)) {
checkState(updated, "Node %s was not updated to %s", lnode, rnode);
}
}
progress.setProgress(count.incrementAndGet());
}
return !cancelled;
}
代码示例来源:origin: locationtech/geogig
/**
* Finds tree pointers that point to the same tree (path and object id) on the left and right
* sides of the comparison but have different {@link NodeRef#getMetadataId() metadata ids}
*/
public Map<NodeRef, NodeRef> findPureMetadataChanges() {
SortedMap<String, MutableTree> leftEntries = leftTree.getChildrenAsMap();
SortedMap<String, MutableTree> rightEntries = rightTree.getChildrenAsMap();
Map<NodeRef, NodeRef> matches = Maps.newTreeMap();
for (Map.Entry<String, MutableTree> e : leftEntries.entrySet()) {
final String nodePath = e.getKey();
final MutableTree leftTree = e.getValue();
final Node leftNode = leftTree.getNode();
@Nullable
final MutableTree rightTree = rightEntries.get(nodePath);
final Node rightNode = rightTree == null ? null : rightTree.getNode();
if (leftNode.equals(rightNode)) {
final Optional<ObjectId> leftMetadata = leftNode.getMetadataId();
final Optional<ObjectId> rightMetadata = rightNode.getMetadataId();
if (!leftMetadata.equals(rightMetadata)) {
String parentPath = NodeRef.parentPath(nodePath);
NodeRef leftRef = new NodeRef(leftNode, parentPath, ObjectId.NULL);
NodeRef rightRef = new NodeRef(rightNode, parentPath, ObjectId.NULL);
matches.put(leftRef, rightRef);
}
}
}
return matches;
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
/**
* Finds tree pointers that point to the same tree (path and object id) on the left and right
* sides of the comparison but have different {@link NodeRef#getMetadataId() metadata ids}
*/
public Map<NodeRef, NodeRef> findPureMetadataChanges() {
SortedMap<String, MutableTree> leftEntries = leftTree.getChildrenAsMap();
SortedMap<String, MutableTree> rightEntries = rightTree.getChildrenAsMap();
Map<NodeRef, NodeRef> matches = Maps.newTreeMap();
for (Map.Entry<String, MutableTree> e : leftEntries.entrySet()) {
final String nodePath = e.getKey();
final MutableTree leftTree = e.getValue();
final Node leftNode = leftTree.getNode();
@Nullable
final MutableTree rightTree = rightEntries.get(nodePath);
final Node rightNode = rightTree == null ? null : rightTree.getNode();
if (leftNode.equals(rightNode)) {
final Optional<ObjectId> leftMetadata = leftNode.getMetadataId();
final Optional<ObjectId> rightMetadata = rightNode.getMetadataId();
if (!leftMetadata.equals(rightMetadata)) {
String parentPath = NodeRef.parentPath(nodePath);
NodeRef leftRef = new NodeRef(leftNode, parentPath, ObjectId.NULL);
NodeRef rightRef = new NodeRef(rightNode, parentPath, ObjectId.NULL);
matches.put(leftRef, rightRef);
}
}
}
return matches;
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
/**
* Overrides to implement a simple optimization for the case where the node bounds haven't
* changed and hence avoid calling remove and then put, but call put only, since the
* {@code NodeId} is guaranteed to lay on the same bucket at any depth.
*/
@Override
public int update(Node oldNode, Node newNode) {
Optional<Envelope> oldBounds = oldNode.bounds();
Optional<Envelope> newBounds = newNode.bounds();
if (oldBounds.equals(newBounds)) {
// in case the bounds didn't change, put will override the old value,
// otherwise need to remove old and add new separately
Preconditions.checkArgument(oldNode.getName().equals(newNode.getName()));
int delta = put(newNode);
if (delta == 0 && !oldNode.equals(newNode)) {
delta = 1;
}
}
return super.update(oldNode, newNode);
}
代码示例来源:origin: locationtech/geogig
/**
* Overrides to implement a simple optimization for the case where the node bounds haven't
* changed and hence avoid calling remove and then put, but call put only, since the
* {@code NodeId} is guaranteed to lay on the same bucket at any depth.
*/
@Override
public int update(Node oldNode, Node newNode) {
Optional<Envelope> oldBounds = oldNode.bounds();
Optional<Envelope> newBounds = newNode.bounds();
if (oldBounds.equals(newBounds)) {
// in case the bounds didn't change, put will override the old value,
// otherwise need to remove old and add new separately
Preconditions.checkArgument(oldNode.getName().equals(newNode.getName()));
int delta = put(newNode);
if (delta == 0 && !oldNode.equals(newNode)) {
delta = 1;
}
}
return super.update(oldNode, newNode);
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
strategy.put(ref);
Node newNode = strategy.getNode(nodeId);
assertFalse(currNode.equals(newNode));
代码示例来源:origin: locationtech/geogig
strategy.put(ref);
Node newNode = strategy.getNode(nodeId);
assertFalse(currNode.equals(newNode));
代码示例来源:origin: locationtech/geogig
@Test
public void testIsEqual() {
Node node = RevObjectFactory.defaultInstance().createNode("Points.1",
ObjectId.valueOf("abc123000000000000001234567890abcdef0000"), ObjectId.NULL,
TYPE.FEATURE, null, null);
Node node2 = RevObjectFactory.defaultInstance().createNode("Lines.1",
ObjectId.valueOf("abc123000000000000001234567890abcdef0001"), ObjectId.NULL,
TYPE.FEATURE, null, null);
Node node3 = RevObjectFactory.defaultInstance().createNode("Lines.1",
ObjectId.valueOf("abc123000000000000001234567890abcdef0001"),
ObjectId.valueOf("abc123000000000000001234567890abcdef0002"), TYPE.TREE, null,
null);
Node node4 = RevObjectFactory.defaultInstance().createNode("Lines.1",
ObjectId.valueOf("abc123000000000000001234567890abcdef0003"), ObjectId.NULL,
TYPE.FEATURE, null, null);
assertFalse(node.equals("NotANode"));
assertFalse(node.equals(node2));
assertFalse(node2.equals(node3));
assertFalse(node2.equals(node4));
assertTrue(node.equals(node));
}
代码示例来源:origin: locationtech/geogig
Node newNode = resultNodes.get(changedNodeName);
assertNotNull(newNode);
assertFalse(oldNode.equals(newNode));
assertEquals(newValues.get(changedNodeName), newNode);
内容来源于网络,如有侵权,请联系作者删除!