// disable path parsing temporarily
pathParsers = stateData.opt.rctx.pathParsers;
stateData.opt.rctx.pathParsers = new PathParser[0];
Edge edge = null;
while (orig.getBackState() != null) {
edge = orig.getBackEdge();
if (optimize) {
// first board/last alight: figure in wait time in on the fly optimization
if (edge instanceof TransitBoardAlight &&
forward &&
orig.getNumBoardings() == 1 &&
(
// boarding in a forward main search
(((TransitBoardAlight) edge).boarding &&
!stateData.opt.arriveBy) ||
// alighting in a reverse main search
(!((TransitBoardAlight) edge).boarding &&
stateData.opt.arriveBy)
)
) {
ret = ((TransitBoardAlight) edge).traverse(ret, orig.getBackState().getTimeSeconds());
newInitialWaitTime = ret.stateData.initialWaitTime;
} else {
ret = edge.traverse(ret);
}
if (ret != null && ret.getBackMode() != null && orig.getBackMode() != null &&
ret.getBackMode() != orig.getBackMode()) {
ret = ret.next; // Keep the mode the same as on the original graph path (in K+R)