protected void initExampleGraph(Graph g) { NodeAccess na = g.getNodeAccess(); na.setNode(0, 12, 23); na.setNode(1, 38.33f, 135.3f); na.setNode(2, 6, 139); na.setNode(3, 78, 89); na.setNode(4, 2, 1); na.setNode(5, 7, 5); g.edge(0, 1, 12, true); g.edge(0, 2, 212, true); g.edge(0, 3, 212, true); g.edge(0, 4, 212, true); g.edge(0, 5, 212, true); }
@Test public void testClone() { graph = createGraph(); graph.edge(1, 2, 10, true); NodeAccess na = graph.getNodeAccess(); na.setNode(0, 12, 23); na.setNode(1, 8, 13); na.setNode(2, 2, 10); na.setNode(3, 5, 9); graph.edge(1, 3, 10, true); Graph clone = graph.copyTo(createGraph(locationParent + "/clone", false)); assertEquals(graph.getNodes(), clone.getNodes()); assertEquals( count(carOutExplorer.setBaseNode(1)), count(clone.createEdgeExplorer(carOutFilter).setBaseNode(1))); clone.edge(1, 4, 10, true); assertEquals(3, count(clone.createEdgeExplorer(carOutFilter).setBaseNode(1))); assertEquals(graph.getBounds(), clone.getBounds()); Helper.close((Closeable) clone); }