org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer.ConstrainedBoardingSearchStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule;
import org.opentripplanner.transit.raptor.api.transit.IntIterator;
import org.opentripplanner.transit.raptor.api.transit.RaptorTimeTable;
import org.opentripplanner.transit.raptor.api.transit.RaptorTripSchedule;
/**
* Used to search forward and in reverse.
*/
interface ConstrainedBoardingSearchStrategy {
/**
*
* - In a forward search return the DEPARTURE time.
*
- In a reverse search return the ARRIVAL time.
*
*/
int time(RaptorTripSchedule schedule, int stopPos);
/**
*
* - In a forward search the time is before another time if it is in the PAST.
*
- In a reverse search the time is before another time if it is in the FUTURE.
*
*/
boolean timeIsBefore(int time0, int time1);
/**
*
* - In a forward search iterate in departure order.
*
- In a reverse search iterate in reverse departure order,
* starting with the last trip in the schedule.
*
*/
IntIterator scheduleIndexIterator(RaptorTimeTable timetable);
/**
*
* - In a forward search add {@code u} and {@code v} together. Example: {@code plus(5, 2) => 7}
*
- In a reverse search subtract {@code v} from {@code u}. Example: {@code plus(5, 2) => 3}
*
*/
int plus(int v, int u);
/**
*
* - In a forward search return the highest time.
*
- In a reverse search return the lowest time.
*
*/
default int maxTime(int v, int u) {
return timeIsBefore(v, u) ? u : v;
}
}