Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Node$TreeNode


        final ImmutableList.Builder<Node> treesBuilder = new ImmutableList.Builder<Node>();
        final SortedMap<Integer, Bucket> buckets = new TreeMap<Integer, Bucket>();

        final int nFeatures = readUnsignedVarInt(in);
        for (int i = 0; i < nFeatures; i++) {
            Node n = readNode(in);
            checkState(RevObject.TYPE.FEATURE.equals(n.getType()),
                    "Non-feature node in tree's feature list.");
            featuresBuilder.add(n);
        }

        final int nTrees = readUnsignedVarInt(in);
        for (int i = 0; i < nTrees; i++) {
            Node n = readNode(in);
            checkState(RevObject.TYPE.TREE.equals(n.getType()),
                    "Non-tree node in tree's subtree list.");

            treesBuilder.add(n);
        }
View Full Code Here


        return new DiffEntry(oldNodeRef, newNodeRef);
    }

    public static NodeRef readNodeRef(DataInput in) throws IOException {
        Node node = readNode(in);
        final ObjectId metadataId = readObjectId(in);
        String parentPath = in.readUTF();
        return new NodeRef(node, parentPath, metadataId);
    }
View Full Code Here

            throw new IllegalStateException(String.format(
                    "Illegal bounds mask: %s, expected one of %s, %s, %s",
                    toBinaryString(boundsMask), toBinaryString(BOUNDS_NULL_MASK),
                    toBinaryString(BOUNDS_POINT_MASK), toBinaryString(BOUNDS_BOX2D_MASK)));
        }
        final Node node;
        node = Node.create(name, objectId, metadataId, contentType, bbox);
        return node;
    }
View Full Code Here

        final ImmutableList.Builder<Node> treesBuilder = new ImmutableList.Builder<Node>();
        final SortedMap<Integer, Bucket> buckets = new TreeMap<Integer, Bucket>();

        final int nFeatures = in.readInt();
        for (int i = 0; i < nFeatures; i++) {
            Node n = readNode(in);
            if (n.getType() != RevObject.TYPE.FEATURE) {
                throw new IllegalStateException("Non-feature node in tree's feature list.");
            }
            featuresBuilder.add(n);
        }

        final int nTrees = in.readInt();
        for (int i = 0; i < nTrees; i++) {
            Node n = readNode(in);
            if (n.getType() != RevObject.TYPE.TREE) {
                throw new IllegalStateException("Non-tree node in tree's subtree list.");
            }
            treesBuilder.add(n);
        }
View Full Code Here

        in.readFully(objectId);
        final byte[] metadataId = new byte[20];
        in.readFully(metadataId);
        final RevObject.TYPE contentType = RevObject.TYPE.valueOf(in.readByte());
        final Envelope bbox = readBBox(in);
        final Node node;
        node = Node.create(name, ObjectId.createNoClone(objectId),
                ObjectId.createNoClone(metadataId), contentType, bbox);
        return node;
    }
View Full Code Here

        return new DiffEntry(oldNodeRef, newNodeRef);
    }

    public static NodeRef readNodeRef(DataInput in) throws IOException {
        Node node = readNode(in);
        final byte[] metadataId = new byte[20];
        in.readFully(metadataId);
        String parentPath = in.readUTF();
        return new NodeRef(node, parentPath, ObjectId.createNoClone(metadataId));
    }
View Full Code Here

    /**
     * @return the resulting parent path after removing left and right from the stack, or
     *         {@code null} if left and/or right are a root tree.
     */
    public String endTree(@Nullable Node left, @Nullable Node right) {
        final Node popLeft = this.leftTrees.pop();
        final Node popRight = this.rightTrees.pop();
        try {
            Preconditions.checkState(Objects.equal(popLeft, left));
            Preconditions.checkState(Objects.equal(popRight, right));
        } catch (IllegalStateException e) {
            throw e;
View Full Code Here

            return;
        }
        // start by asking the consumer if go on with the walk at all with the
        // root nodes
        Envelope lbounds = SpatialOps.boundsOf(left);
        Node lnode = Node.create(NodeRef.ROOT, left.getId(), ObjectId.NULL, TYPE.TREE, lbounds);

        Envelope rbounds = SpatialOps.boundsOf(right);
        Node rnode = Node.create(NodeRef.ROOT, right.getId(), ObjectId.NULL, TYPE.TREE, rbounds);

        if (consumer.tree(lnode, rnode)) {
            traverseTree(consumer, left, right, 0);
        }
        consumer.endTree(lnode, rnode);
View Full Code Here

    private void traverseLeafLeaf(Consumer consumer, Iterator<Node> leftc, Iterator<Node> rightc) {
        PeekingIterator<Node> li = Iterators.peekingIterator(leftc);
        PeekingIterator<Node> ri = Iterators.peekingIterator(rightc);

        while (li.hasNext() && ri.hasNext()) {
            Node lpeek = li.peek();
            Node rpeek = ri.peek();
            int order = ORDER.compare(lpeek, rpeek);
            if (order < 0) {
                node(consumer, li.next(), null);// removal
            } else if (order == 0) {// change
                // same feature at both sides of the traversal, consume them and check if its
                // changed it or not
                Node l = li.next();
                Node r = ri.next();
                if (!l.equals(r)) {
                    node(consumer, l, r);
                }
            } else {
                node(consumer, null, ri.next());// addition
View Full Code Here

        toString(this, sb, 0);
        return sb.toString();
    }

    private void toString(MutableTree tree, StringBuilder sb, int indent) {
        Node node = tree.getNode();
        append(sb, node, indent);

        for (MutableTree c : tree.childTrees.values()) {
            toString(c, sb, indent + 1);
        }
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.Node$TreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.