Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree#put()
The following examples show how to use
org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree#put() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeSerializerFailureTests.java From tinkerpop with Apache License 2.0 | 5 votes |
@Parameterized.Parameters(name = "Value={0}") public static Collection input() { final Bytecode.Binding b = new Bytecode.Binding(null, "b"); final ReferenceVertex vertex = new ReferenceVertex("a vertex", null); final Bytecode bytecode = new Bytecode(); bytecode.addStep(null); final BulkSet<Object> bulkSet = new BulkSet<>(); bulkSet.add(vertex, 1L); final MutableMetrics metrics = new MutableMetrics("a metric", null); final Tree<Vertex> tree = new Tree<>(); tree.put(vertex, null); // Provide instances that are malformed for serialization to fail return Arrays.asList( b, vertex, Collections.singletonMap("one", b), bulkSet, bytecode, Collections.singletonList(vertex), new ReferenceEdge("an edge", null, vertex, vertex), Lambda.supplier(null), metrics, new DefaultTraversalMetrics(1L, Collections.singletonList(metrics)), new DefaultRemoteTraverser<>(new Object(), 1L), tree, new ReferenceVertexProperty<>("a prop", null, "value"), new InvalidPath() ); }
Example 2
Source File: GraphSONSerializersV3d0.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override public Tree deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException { final List<Map> data = deserializationContext.readValue(jsonParser, List.class); final Tree t = new Tree(); for (Map<String, Object> entry : data) { t.put(entry.get(GraphSONTokens.KEY), entry.get(GraphSONTokens.VALUE)); } return t; }
Example 3
Source File: GraphSONSerializersV2d0.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override public Tree deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException { final List<Map> data = deserializationContext.readValue(jsonParser, List.class); final Tree t = new Tree(); for (Map<String, Object> entry : data) { t.put(entry.get(GraphSONTokens.KEY), entry.get(GraphSONTokens.VALUE)); } return t; }
Example 4
Source File: TreeSerializer.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override protected Tree readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { final int length = buffer.readInt(); final Tree result = new Tree(); for (int i = 0; i < length; i++) { result.put(context.read(buffer), context.readValue(buffer, Tree.class, false)); } return result; }
Example 5
Source File: SortedTree.java From sqlg with MIT License | 4 votes |
public static void main(String[] args) { Tree<String> tree = new Tree<>(); Tree<String> aTree = new Tree<>(); tree.put("a", aTree); Tree<String> bTree = new Tree<>(); tree.put("b", bTree); Tree<String> abTree = new Tree<>(); aTree.put("ab", abTree); Tree<String> bbTree = new Tree<>(); bTree.put("bb", bbTree); System.out.println(tree); SortedTree<String> sortedTree = new SortedTree<>((o1, o2) -> o1.compareTo(o2) * -1); sortedTree.addTree(tree); System.out.println(sortedTree); }