Package com.tinkerpop.gremlin.process.graph.util

Examples of com.tinkerpop.gremlin.process.graph.util.Tree


        this.sideEffectKey = null == sideEffectKey ? this.getLabel() : sideEffectKey;
        this.functionRing = new FunctionRing(branchFunctions);
        TraversalHelper.verifySideEffectKeyIsNotAStepLabel(this.sideEffectKey, this.traversal);
        this.traversal.sideEffects().registerSupplierIfAbsent(this.sideEffectKey, Tree::new);
        this.setConsumer(traverser -> {
            Tree depth = this.getTraversal().sideEffects().get(this.sideEffectKey);
            final Path path = traverser.path();
            for (int i = 0; i < path.size(); i++) {
                final Object object = functionRing.next().apply(path.get(i));
                if (!depth.containsKey(object))
                    depth.put(object, new Tree<>());
                depth = (Tree) depth.get(object);
            }
            this.functionRing.reset();
        });
    }
View Full Code Here


        }
    }

    @Override
    public Tree generateFinalResult(final Iterator<Pair<Object, Tree>> keyValues) {
        final Tree result = new Tree();
        keyValues.forEachRemaining(pair -> result.addTree(pair.getValue1()));
        return result;
    }
View Full Code Here

        List<Traversal<Vertex, Tree>> traversals = Arrays.asList(
                get_g_v1_out_out_treeXnameX(convertToVertexId("marko")),
                get_g_v1_out_out_treeXa_nameX_both_both_capXaX(convertToVertexId("marko")));
        traversals.forEach(traversal -> {
            printTraversalForm(traversal);
            final Tree tree = traversal.next();
            assertFalse(traversal.hasNext());
            assertEquals(1, tree.size());
            assertTrue(tree.containsKey("marko"));
            assertEquals(1, ((Map) tree.get("marko")).size());
            assertTrue(((Map) tree.get("marko")).containsKey("josh"));
            assertTrue(((Map) ((Map) tree.get("marko")).get("josh")).containsKey("lop"));
            assertTrue(((Map) ((Map) tree.get("marko")).get("josh")).containsKey("ripple"));
        });
    }
View Full Code Here

    @LoadGraphWith(MODERN)
    public void g_V_out_out_treeXidX() {
        List<Traversal<Vertex, Tree>> traversals = Arrays.asList(get_g_V_out_out_treeXidX(), get_g_V_out_out_treeXa_idX());
        traversals.forEach(traversal -> {
            printTraversalForm(traversal);
            final Tree tree = traversal.next();
            assertFalse(traversal.hasNext());
            assertEquals(1, tree.size());
            assertTrue(tree.containsKey(convertToVertexId("marko")));
            assertEquals(1, ((Map) tree.get(convertToVertexId("marko"))).size());
            assertTrue(((Map) tree.get(convertToVertexId("marko"))).containsKey(convertToVertexId("josh")));
            assertTrue(((Map) ((Map) tree.get(convertToVertexId("marko"))).get(convertToVertexId("josh"))).containsKey(convertToVertexId("lop")));
            assertTrue(((Map) ((Map) tree.get(convertToVertexId("marko"))).get(convertToVertexId("josh"))).containsKey(convertToVertexId("ripple")));
        });
    }
View Full Code Here

    @LoadGraphWith(MODERN)
    public void g_V_out_out_treeXaX() {
        List<Traversal<Vertex, Tree>> traversals = Arrays.asList(get_g_V_out_out_treeXaX());
        traversals.forEach(traversal -> {
            printTraversalForm(traversal);
            final Tree tree = traversal.next();
            assertFalse(traversal.hasNext());
            assertEquals(1, tree.size());
            assertTrue(tree.containsKey(convertToVertex(g, "marko")));
            assertEquals(1, ((Map) tree.get(convertToVertex(g, "marko"))).size());
            assertTrue(((Map) tree.get(convertToVertex(g, "marko"))).containsKey(convertToVertex(g, "josh")));
            assertTrue(((Map) ((Map) tree.get(convertToVertex(g, "marko"))).get(convertToVertex(g, "josh"))).containsKey(convertToVertex(g, "lop")));
            assertTrue(((Map) ((Map) tree.get(convertToVertex(g, "marko"))).get(convertToVertex(g, "josh"))).containsKey(convertToVertex(g, "ripple")));
        });
    }
View Full Code Here

TOP

Related Classes of com.tinkerpop.gremlin.process.graph.util.Tree

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.