예제 #1
0
  @Test
  public void testNoExpand() {
    LevelGraph g = createGraph(20);
    g.edge(0, 1, 10, true); // 1
    g.edge(1, 2, 10, true); // 2
    g.edge(2, 3, 10, true); // 3
    g.edge(3, 4, 10, true); // 4

    Path4Shortcuts path = new Path4Shortcuts(g, ShortestCarCalc.DEFAULT);
    path.edgeEntry = new EdgeEntry(3, 3, 10);
    path.edgeEntry.parent = new EdgeEntry(2, 2, 10);
    path.edgeEntry.parent.parent = new EdgeEntry(1, 1, 10);
    path.edgeEntry.parent.parent.parent = new EdgeEntry(EdgeIterator.NO_EDGE, 0, 0);
    path.edgeTo = new EdgeEntry(4, 3, 10);
    path.edgeTo.parent = new EdgeEntry(EdgeIterator.NO_EDGE, 4, 0);
    Path p = path.extract();
    assertEquals(5, p.calcNodes().size());
    assertEquals(Helper.createTList(0, 1, 2, 3, 4), p.calcNodes());
  }
예제 #2
0
  @Test
  public void testExpandMultipleSkippedNodes() {
    LevelGraphStorage g = (LevelGraphStorage) createGraph(20);
    EdgeSkipIterator iter = g.edge(0, 1, 10, true); // 1
    g.edge(1, 2, 10, true); // 2
    g.edge(2, 3, 10, true); // 3
    g.edge(3, 4, 10, true); // 4

    g.setLevel(1, -1);
    g.setLevel(2, -1);
    g.edge(0, 3, 30, CarStreetType.flagsDefault(true)).skippedEdge(iter.edge()); // 5

    Path4Shortcuts path = new Path4Shortcuts(g, ShortestCarCalc.DEFAULT);
    path.edgeEntry = new EdgeEntry(5, 3, 30);
    path.edgeEntry.parent = new EdgeEntry(-1, 0, 0);
    path.edgeTo = new EdgeEntry(4, 3, 10);
    path.edgeTo.parent = new EdgeEntry(EdgeIterator.NO_EDGE, 4, 0);
    Path p = path.extract();
    assertEquals(Helper.createTList(0, 1, 2, 3, 4), p.calcNodes());
  }