org.locationtech.geogig.model.Node.getType()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中org.locationtech.geogig.model.Node.getType()方法的一些代码示例,展示了Node.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getType()方法的具体详情如下:
包路径:org.locationtech.geogig.model.Node
类名称:Node
方法名:getType

Node.getType介绍

暂无

代码示例

代码示例来源:origin: locationtech/geogig

  1. /**
  2. * @return the {@link RevObject.TYPE} of the {@code Node} this object points to
  3. */
  4. public RevObject.TYPE getType() {
  5. return node.getType();
  6. }

代码示例来源:origin: org.locationtech.geogig/geogig-api

  1. /**
  2. * @return the {@link RevObject.TYPE} of the {@code Node} this object points to
  3. */
  4. public RevObject.TYPE getType() {
  5. return node.getType();
  6. }

代码示例来源:origin: locationtech/geogig

  1. private void checkNode(Node node, TYPE type, int index) {
  2. if (node == null) {
  3. throw new NullPointerException(
  4. "null node in " + type.toString().toLowerCase() + "s at index " + index);
  5. }
  6. if (node.getType() != type) {
  7. throw new IllegalArgumentException(type.toString().toLowerCase() + "s contains "
  8. + node.getType() + " node at index " + index);
  9. }
  10. }

代码示例来源:origin: locationtech/geogig

  1. @Override
  2. public int put(final Node node) {
  3. Preconditions.checkArgument(TYPE.FEATURE == node.getType(),
  4. "Can't add non feature nodes to quad-tree: %s", node);
  5. return super.put(node);
  6. }

代码示例来源:origin: org.locationtech.geogig/geogig-core

  1. @Override
  2. public int put(final Node node) {
  3. Preconditions.checkArgument(TYPE.FEATURE == node.getType(),
  4. "Can't add non feature nodes to quad-tree: %s", node);
  5. return super.put(node);
  6. }

代码示例来源:origin: locationtech/geogig

  1. /**
  2. * Equality check based on {@link #getName() name}, {@link #getType() type}, and
  3. * {@link #getObjectId() objectId}; {@link #getMetadataId()} is NOT part of the equality check.
  4. */
  5. public static boolean equals(@NonNull Node node, @Nullable Object o) {
  6. if (o instanceof Node) {
  7. Node r = (Node) o;
  8. return node.getType().equals(r.getType()) && node.getName().equals(r.getName())
  9. && node.getObjectId().equals(r.getObjectId());
  10. }
  11. return false;
  12. }

代码示例来源:origin: locationtech/geogig

  1. public static String toString(@NonNull Node node) {
  2. Envelope env = node.bounds().orNull();
  3. String bounds = env == null ? null : env.toString();
  4. return String.format("%s[%s -> %s, type: %s, md id: %s, bounds: %s]", //
  5. node.getClass().getSimpleName(), //
  6. node.getName(), //
  7. toShortString(node.getObjectId()), //
  8. node.getType(), //
  9. (node.getMetadataId().isPresent() ? toShortString(node.getMetadataId().get())
  10. : "NULL"), //
  11. bounds);
  12. }

代码示例来源:origin: locationtech/geogig

  1. public static int hashCode(@NonNull Node node) {
  2. return 17 ^ node.getType().hashCode() * node.getName().hashCode()
  3. * node.getObjectId().hashCode();
  4. }

代码示例来源:origin: org.locationtech.geogig/geogig-api

  1. public Node update(final ObjectId newId, final @Nullable Envelope newBounds) {
  2. ObjectId mdId = getMetadataId().or(ObjectId.NULL);
  3. return Node.create(getName(), newId, mdId, getType(), newBounds, getExtraData());
  4. }

代码示例来源:origin: locationtech/geogig

  1. /**
  2. * Provides for natural ordering of {@code Node}, based on {@link #getName() name}
  3. */
  4. public final @Override int compareTo(Node o) {
  5. int c = getName().compareTo(o.getName());
  6. if (c == 0) {
  7. c = getType().compareTo(o.getType());
  8. }
  9. if (c == 0) {
  10. c = getObjectId().compareTo(o.getObjectId());
  11. }
  12. return c;
  13. }

代码示例来源:origin: org.locationtech.geogig/geogig-api

  1. /**
  2. * Equality check based on {@link #getName() name}, {@link #getType() type}, and
  3. * {@link #getObjectId() objectId}; {@link #getMetadataId()} is NOT part of the equality check.
  4. */
  5. @Override
  6. public final boolean equals(Object o) {
  7. if (!(o instanceof Node)) {
  8. return false;
  9. }
  10. Node r = (Node) o;
  11. return getType().equals(r.getType()) && getName().equals(r.getName())
  12. && getObjectId().equals(r.getObjectId());
  13. }

代码示例来源:origin: org.locationtech.geogig/geogig-api

  1. /**
  2. * Hash code is based on name and object id
  3. */
  4. @Override
  5. public final int hashCode() {
  6. return 17 ^ getType().hashCode() * getName().hashCode() * getObjectId().hashCode();
  7. }

代码示例来源:origin: locationtech/geogig

  1. public Node update(final ObjectId newId, final @Nullable Envelope newBounds) {
  2. ObjectId mdId = getMetadataId().or(ObjectId.NULL);
  3. return RevObjectFactory.defaultInstance().createNode(getName(), newId, mdId, getType(),
  4. newBounds, getExtraData());
  5. }

代码示例来源:origin: org.locationtech.geogig/geogig-core

  1. private long sizeOf(Node node) {
  2. return node.getType().equals(TYPE.TREE) ? sizeOfTree(node.getObjectId()) : 1L;
  3. }

代码示例来源:origin: locationtech/geogig

  1. @Override
  2. public void funnel(Node ref, PrimitiveSink into) {
  3. RevObjectTypeFunnel.funnel(ref.getType(), into);
  4. StringFunnel.funnel((CharSequence) ref.getName(), into);
  5. ObjectIdFunnel.funnel(ref.getObjectId(), into);
  6. ObjectIdFunnel.funnel(ref.getMetadataId().or(ObjectId.NULL), into);
  7. Map<String, Object> extraData = ref.getExtraData();
  8. // consider extraData only if it's not empty to maintain backwards compatibility with
  9. // Geogig pre 1.1
  10. if (!extraData.isEmpty()) {
  11. PropertyValueFunnel.funnel(extraData, into);
  12. }
  13. }
  14. };

代码示例来源:origin: locationtech/geogig

  1. private long sizeOf(Node node) {
  2. return node.getType().equals(TYPE.TREE) ? sizeOfTree(node.getObjectId()) : 1L;
  3. }

代码示例来源:origin: org.locationtech.geogig/geogig-web-api

  1. private void writeNode(Node node, String tag) throws StreamWriterException {
  2. out.writeStartArrayElement(tag);
  3. writeElement("name", node.getName());
  4. writeElement("type", node.getType().name());
  5. writeElement("objectid", node.getObjectId().toString());
  6. writeElement("metadataid", node.getMetadataId().or(ObjectId.NULL).toString());
  7. out.writeEndArrayElement();
  8. }

代码示例来源:origin: locationtech/geogig

  1. private void assertNode(MutableTree mutableTree, ObjectId treeId, @Nullable ObjectId metadtaId,
  2. String nodeName) {
  3. assertNotNull(mutableTree);
  4. Node node = mutableTree.getNode();
  5. assertNotNull(node);
  6. assertEquals(treeId, node.getObjectId());
  7. if (metadtaId == null) {
  8. assertFalse(node.getMetadataId().isPresent());
  9. } else {
  10. assertEquals(metadtaId, node.getMetadataId().get());
  11. }
  12. assertEquals(nodeName, node.getName());
  13. assertEquals(TYPE.TREE, node.getType());
  14. }

代码示例来源:origin: org.locationtech.geogig/geogig-core

  1. private void assertNode(MutableTree mutableTree, ObjectId treeId, @Nullable ObjectId metadtaId,
  2. String nodeName) {
  3. assertNotNull(mutableTree);
  4. Node node = mutableTree.getNode();
  5. assertNotNull(node);
  6. assertEquals(treeId, node.getObjectId());
  7. if (metadtaId == null) {
  8. assertFalse(node.getMetadataId().isPresent());
  9. } else {
  10. assertEquals(metadtaId, node.getMetadataId().get());
  11. }
  12. assertEquals(nodeName, node.getName());
  13. assertEquals(TYPE.TREE, node.getType());
  14. }

代码示例来源:origin: locationtech/geogig

  1. @Test
  2. public void testNodeAccessorsAndConstructors() {
  3. ObjectId oid = ObjectId.valueOf("abc123000000000000001234567890abcdef0000");
  4. Map<String, Object> extraData = new HashMap<String, Object>();
  5. extraData.put("key", "value");
  6. Node node = RevObjectFactory.defaultInstance().createNode("Points", oid, ObjectId.NULL,
  7. TYPE.TREE, null, extraData);
  8. assertEquals(Optional.absent(), node.getMetadataId());
  9. assertEquals("Points", node.getName());
  10. assertEquals(oid, node.getObjectId());
  11. assertEquals(TYPE.TREE, node.getType());
  12. assertEquals(extraData, node.getExtraData());
  13. }

相关文章