Package org.locationtech.geogig.api

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


            entriesOnlyOnRight.remove(renamedTo.path());
        }

        SortedSet<NodeRef> newTreeRefs = Sets.newTreeSet();
        for (Map.Entry<String, MutableTree> newTree : entriesOnlyOnRight.entrySet()) {
            Node node = newTree.getValue().getNode();
            String parentPath = NodeRef.parentPath(newTree.getKey());
            // pass NULL to the NodeRef metadataId, to it defers to the one in the Node in case it
            // has one (see NodeRef.getMetadataId())
            ObjectId metadataId = ObjectId.NULL;
            NodeRef ref = new NodeRef(node, parentPath, metadataId);
View Full Code Here


        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);
View Full Code Here

    private void testOrder(final int count) throws Exception {

        List<Node> expected = new ArrayList<Node>(count);
        for (int i = 0; i < count; i++) {
            Node node = node(i);
            index.add(node);
            expected.add(node);
        }
        Collections.sort(expected, new NodeStorageOrder());

        Iterator<Node> nodeIterator = index.nodes();
        List<Node> actual = Lists.newArrayList(nodeIterator);

        assertEquals(expected.size(), actual.size());
        for (int i = 0; i < expected.size(); i++) {
            Node expectedNode = expected.get(i);
            Node actualNode = actual.get(i);
            assertEquals("At index " + i, expectedNode, actualNode);
        }
    }
View Full Code Here

    @Test
    public void testInsertSingle() throws Exception {
        Name name = points1.getType().getName();
        String parentPath = name.getLocalPart();
        Node ref = workTree.insert(parentPath, points1);
        ObjectId objectId = ref.getObjectId();

        assertEquals(objectId, workTree.findUnstaged(appendChild(pointsName, idP1)).get()
                .getObjectId());
    }
View Full Code Here

        List<Node> targetList = new LinkedList<Node>();
        workTree.insert(pointsName, featureList.iterator(), LISTENER, targetList, 3);

        assertEquals(3, targetList.size());

        Node ref1 = targetList.get(0);
        Node ref2 = targetList.get(1);
        Node ref3 = targetList.get(2);

        assertEquals(ref1.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP1)).get()
                .getObjectId());
        assertEquals(ref2.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP2)).get()
                .getObjectId());
        assertEquals(ref3.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP3)).get()
                .getObjectId());
    }
View Full Code Here

        List<Node> targetList = new LinkedList<Node>();
        workTree.insert(pointsName, featureList.iterator(), LISTENER, targetList, 1);

        assertEquals(1, targetList.size());

        Node ref1 = targetList.get(0);
        assertEquals(ref1.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP1)).get()
                .getObjectId());

        featureList.clear();
        featureList.add(new FeatureToDelete(pointsType, idP1));
        featureList.add(points2);
        featureList.add(points3);

        targetList.clear();

        workTree.insert(pointsName, featureList.iterator(), LISTENER, targetList, 3);

        assertEquals(2, targetList.size());

        Node ref2 = targetList.get(0);
        Node ref3 = targetList.get(1);

        assertFalse(workTree.findUnstaged(appendChild(pointsName, idP1)).isPresent());
        assertEquals(ref2.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP2)).get()
                .getObjectId());
        assertEquals(ref3.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP3)).get()
                .getObjectId());
    }
View Full Code Here

        List<Node> targetList = new LinkedList<Node>();
        workTree.insert(pointsName, featureList.iterator(), LISTENER, targetList, null);

        assertEquals(3, targetList.size());

        Node ref1 = targetList.get(0);
        Node ref2 = targetList.get(1);
        Node ref3 = targetList.get(2);

        assertEquals(ref1.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP1)).get()
                .getObjectId());
        assertEquals(ref2.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP2)).get()
                .getObjectId());
        assertEquals(ref3.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP3)).get()
                .getObjectId());
    }
View Full Code Here

        List<Node> targetList = new LinkedList<Node>();
        workTree.insert(pointsName, featureList.iterator(), LISTENER, targetList, 0);

        assertEquals(3, targetList.size());

        Node ref1 = targetList.get(0);
        Node ref2 = targetList.get(1);
        Node ref3 = targetList.get(2);

        assertEquals(ref1.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP1)).get()
                .getObjectId());
        assertEquals(ref2.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP2)).get()
                .getObjectId());
        assertEquals(ref3.getObjectId(), workTree.findUnstaged(appendChild(pointsName, idP3)).get()
                .getObjectId());
    }
View Full Code Here

        if (feature.isPresent()) {
            RevFeatureType featureType = getFeatureTypeFromRefSpec();
            RevFeature feat = feature.get();
            Envelope bounds = SpatialOps.boundsOf(feat);
            Node node = Node.create(NodeRef.nodeFromPath(ref), feat.getId(), featureType.getId(),
                    TYPE.FEATURE, bounds);
            return Optional.of(new NodeRef(node, NodeRef.parentPath(ref), featureType.getId()));

        } else {
            return Optional.absent();
View Full Code Here

                while (randomEdits.containsKey(random = randGen.nextInt(numEntries))) {
                    ; // $codepro.audit.disable extraSemicolon
                }
                String name = "Feature." + random;
                ObjectId newid = ObjectId.forString(name + "changed");
                Node ref = Node.create(name, newid, ObjectId.NULL, TYPE.FEATURE, null);
                randomEdits.put(random, ref);
            }
            RevTreeBuilder mutable = tree.builder(odb);
            sw.reset().start();
            for (Node ref : randomEdits.values()) {
                mutable.put(ref);
            }
            mutable.build();
            sw.stop();
            System.err.println(randomEdits.size() + " random modifications in " + sw);
        }

        // CharSequence treeStr =
        // repo.command(CatObject.class).setObject(Suppliers.ofInstance(tree))
        // .call();
        // System.out.println(treeStr);

        final FindTreeChild childFinder = repo.command(FindTreeChild.class).setParent(tree);

        sw.reset().start();
        System.err.println("Reading " + numEntries + " entries....");
        for (int i = 0; i < numEntries; i++) {
            if ((i + 1) % (numEntries / 10) == 0) {
                System.err.print("#" + (i + 1));
            } else if ((i + 1) % (numEntries / 100) == 0) {
                System.err.print('.');
            }
            String key = "Feature." + i;
            // ObjectId oid = ObjectId.forString(key);
            Optional<NodeRef> ref = childFinder.setChildPath(key).call();
            assertTrue(key, ref.isPresent());
            // assertEquals(key, ref.get().getPath());
            // assertEquals(key, oid, ref.get().getObjectId());
        }
        sw.stop();
        System.err.println("\nGot " + numEntries + " in " + sw.elapsed(TimeUnit.MILLISECONDS)
View Full Code Here

TOP

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

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.