+ new Date(newStart * 1000L));
/* And use it for onboard departure */
double lat = end.getLat();
double lon = end.getLon(); // Mock location, not really important here.
OnboardDepartVertex onboardOrigin = new OnboardDepartVertex("OnBoard_Origin", lat, lon);
@SuppressWarnings("unused")
OnBoardDepartPatternHop currentHop = new OnBoardDepartPatternHop(onboardOrigin, nextV,
tripTimes, options.rctx.serviceDays.get(1), stopIndex, k);
options.dateTime = newStart;
options.setRoutingContext(graph, onboardOrigin, destination);
spt = aStar.getShortestPathTree(options);
/* Re-compute a new path starting boarded */
GraphPath path2 = spt.getPath(destination, false);
assertNotNull(path2);
if (verbose)
System.out.println("PATH 2 ---------------------");
long arrivalTime2 = 0L;
long elapsedTime2 = 0L;
int numBoardings2 = 0;
Vertex arrivalVertex2 = null;
for (State s : path2.states) {
if (verbose)
System.out.println(s + " [" + s.getVertex().getClass().getName() + "]");
arrivalTime2 = s.getTimeSeconds();
arrivalVertex2 = s.getVertex();
elapsedTime2 = s.getElapsedTimeSeconds();
numBoardings2 = s.getNumBoardings();
}
/* Arrival time and vertex *must* match */
assertEquals(arrivalTime1, arrivalTime2);
assertEquals(arrivalVertex1, destination);
assertEquals(arrivalVertex2, destination);
/* On-board *must* be shorter in time */
assertTrue(elapsedTime2 <= elapsedTime1);
/* On-board *must* have less boardings */
assertTrue(numBoardings2 < numBoardings1);
/* Cleanup edges */
int nRemoved = onboardOrigin.removeTemporaryEdges(graph);
assertEquals(1, nRemoved);
n++;
if (n > NTESTS)
break;