本文整理了Java中org.locationtech.geogig.model.Node
类的一些代码示例,展示了Node
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node
类的具体详情如下:
包路径:org.locationtech.geogig.model.Node
类名称:Node
[英]An identifier->object id mapping for an object
[中]对象的标识符->对象id映射
代码示例来源:origin: org.locationtech.geogig/geogig-api
public Node update(final ObjectId newId, final @Nullable Envelope newBounds) {
ObjectId mdId = getMetadataId().or(ObjectId.NULL);
return Node.create(getName(), newId, mdId, getType(), newBounds, getExtraData());
}
代码示例来源:origin: locationtech/geogig
static BoundedSimpleFeature empty(SimpleFeatureType type, Node node,
CoordinateReferenceSystem crs) {
FeatureId fid = new FeatureIdImpl(node.getName());
ReferencedEnvelope env = new ReferencedEnvelope(crs);
node.expand(env);
return new BoundedSimpleFeature(Collections.emptyList(), type, fid, env);
}
}
代码示例来源:origin: locationtech/geogig
/**
* Provides for natural ordering of {@code Node}, based on {@link #getName() name}
*/
public final @Override int compareTo(Node o) {
int c = getName().compareTo(o.getName());
if (c == 0) {
c = getType().compareTo(o.getType());
}
if (c == 0) {
c = getObjectId().compareTo(o.getObjectId());
}
return c;
}
代码示例来源:origin: locationtech/geogig
public Node update(final ObjectId newId) {
return update(newId, bounds().orNull());
}
代码示例来源:origin: locationtech/geogig
private void append(StringBuilder sb, Node node, int indent) {
sb.append(Strings.repeat(" ", indent)).append(node.getName()).append("->")
.append(node.getObjectId()).append(" (").append(node.getMetadataId()).append(")\n");
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
private void verifyMetadata(Node node) {
if (node.getMetadataId().isPresent()) {
ObjectId mdId = node.getMetadataId().get();
String msg = "RevFeatureType " + mdId + " is not present (from " + node.getName() + ")";
assertTrue(msg, objectDb.exists(mdId));
}
}
代码示例来源:origin: locationtech/geogig
private void assertNodesEqual(List<Node> l1, List<Node> l2) {
assertEquals(l1, l2);
for (int i = 0; i < l1.size(); i++) {
Node n1 = l1.get(i);
Node n2 = l2.get(i);
assertEquals(n1.getExtraData(), n2.getExtraData());
assertEquals(n1.getMetadataId(), n2.getMetadataId());
assertEquals(n1.bounds(), n2.bounds());
}
}
代码示例来源: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
/**
* @return the simple name of the {@link Node} this object points to
*/
public String name() {
return node.getName();
}
代码示例来源:origin: locationtech/geogig
private void verifyFeature(Node node) {
ObjectId objectId = node.getObjectId();
assertTrue("feature " + node.getName() + " -> " + objectId + " is not present in objectDb",
objectDb.exists(objectId));
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
public RevTree build(ObjectStore store) {
final ObjectId treeId = this.node.getObjectId();
final RevTree original = EMPTY_TREE_ID.equals(treeId) ? EMPTY : store.getTree(treeId);
CanonicalTreeBuilder builder = CanonicalTreeBuilder.create(store, original);// .clearSubtrees();
ImmutableList<Node> currentTrees = original.trees();
currentTrees.forEach((n) -> builder.remove(n.getName()));
for (MutableTree childTree : this.childTrees.values()) {
childTree.build(store);
Node newNode = childTree.node;
builder.put(newNode);
}
final Node oldNode = this.node;
RevTree newTree = builder.build();
Envelope newBounds = SpatialOps.boundsOf(newTree);
Node newNode = oldNode.update(newTree.getId(), newBounds);
this.node = newNode;
return newTree;
}
代码示例来源:origin: locationtech/geogig
/**
* Expands the provided {@link Envelope} to encompass the {@code Node} this object points to.
*
* @param env the {@link Envelope} to expand
*/
@Override
public void expand(Envelope env) {
node.expand(env);
}
代码示例来源:origin: locationtech/geogig
/**
* @return a {@link NodeId} whose {@link NodeId#value() value} is the node's
* {@link Node#bounds() bounds} {@link Envelope} or {@code null}
*/
@Override
public NodeId computeId(final Node node) {
@Nullable
Envelope bounds = node.bounds().orNull();
return new NodeId(node.getName(), bounds);
}
代码示例来源: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: locationtech/geogig
/**
* @deprecated use {@link #getObjectId()} instead
*/
@Deprecated
public ObjectId objectId() {
return node.getObjectId();
}
代码示例来源:origin: locationtech/geogig
public boolean remove(Node node) {
if (!node.getObjectId().isNull()) {
node = node.update(ObjectId.NULL);
}
int delta = put(node);
return -1 == delta;
}
代码示例来源:origin: locationtech/geogig
/**
* @deprecated use {@link RevObjectFactory#createNode}
*/
public static Node tree(final String name, final ObjectId oid, final ObjectId metadataId) {
return create(name, oid, metadataId, TYPE.TREE, null);
}
代码示例来源: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: locationtech/geogig
@SuppressWarnings("unchecked")
public static Map<String, Object> getMaterializedAttributes(Node n) {
Object v = n.getExtraData(IndexInfo.FEATURE_ATTRIBUTES_EXTRA_DATA);
Preconditions.checkArgument(v == null || v instanceof Map);
return (Map<String, Object>) v;
}
代码示例来源:origin: org.locationtech.geogig/geogig-core
public Node createNode(String name, @Nullable Envelope bounds) {
ObjectId id = RevObjectTestSupport.hashString(name);
Node n = Node.create(name, id, ObjectId.NULL, RevObject.TYPE.FEATURE, bounds);
if (bounds != null && !bounds.isNull()) {
Envelope float32Bounds = n.bounds().get();
Assert.assertTrue(float32Bounds.contains(bounds));
}
return n;
}
内容来源于网络,如有侵权,请联系作者删除!