bestTripTimes = tripTimes;
}
}
}
if (bestWait < 0) return null; // no appropriate trip was found
Trip trip = bestTripTimes.trip;
/* check if route and/or Agency are banned for this plan */
// FIXME this should be done WHILE searching for a trip.
if (options.tripIsBanned(trip)) return null;
/* Check if route is preferred by the user. */
long preferences_penalty = options.preferencesPenaltyForRoute(getPattern().route);
/* Compute penalty for non-preferred transfers. */
int transferPenalty = 0;
/* If this is not the first boarding, then we are transferring. */
if (s0.isEverBoarded()) {
TransferTable transferTable = options.getRoutingContext().transferTable;
int transferTime = transferTable.getTransferTime(s0.getPreviousStop(),
getStop(), s0.getPreviousTrip(), trip, boarding);
transferPenalty = transferTable.determineTransferPenalty(transferTime,
options.nonpreferredTransferPenalty);
}
/* Found a trip to board. Now make the child state. */
StateEditor s1 = s0.edit(this);
s1.setBackMode(getMode());
s1.setServiceDay(bestServiceDay);
// Save the trip times in the State to ensure that router has a consistent view
// and constant-time access to them.
s1.setTripTimes(bestTripTimes);
s1.incrementTimeInSeconds(bestWait);
s1.incrementNumBoardings();
s1.setTripId(trip.getId());
s1.setPreviousTrip(trip);
s1.setZone(getPattern().getZone(stopIndex));
s1.setRoute(trip.getRoute().getId());
double wait_cost = bestWait;
if (!s0.isEverBoarded() && !options.reverseOptimizing) {
wait_cost *= options.waitAtBeginningFactor;