All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.transit.raptor.rangeraptor.path.DestinationArrival Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.transit.raptor.rangeraptor.path;

import org.opentripplanner.transit.raptor.api.transit.RaptorTransfer;
import org.opentripplanner.transit.raptor.api.transit.RaptorTripSchedule;
import org.opentripplanner.transit.raptor.api.view.ArrivalView;
import org.opentripplanner.transit.raptor.api.view.EgressPathView;


/**
 * The purpose of this class is hold information about a destination arrival and
 * compute the values for arrival time and cost.
 * 

* Compared with the ParetoSet of each stop we need two extra criteria: *

    *
  • Number of transfers. The McRangeRaptor works in rounds, so * there is no need to include rounds in the intermediate stop pareto sets. * But to avoid that a later iteration delete an earlier result with less * transfers, transfers need to be added as a criterion to the final destination. * *
  • Travel time duration - Range Raptor works in iteration. So when a * later iteration makes it into the destination set - it should not erase * an earlier result unless it is faster. There is no check on total travel * duration for each stop, because it does not need to. * *
* * @param The TripSchedule type defined by the user of the raptor API. */ public class DestinationArrival implements ArrivalView { private final ArrivalView previous; private final RaptorTransfer egress; private final int arrivalTime; private final int numberOfTransfers; private final int cost; public DestinationArrival( RaptorTransfer egress, ArrivalView previous, int arrivalTime, int additionalCost ) { this.previous = previous; this.egress = egress; this.arrivalTime = arrivalTime; this.numberOfTransfers = previous.round() - 1; this.cost = previous.cost() + additionalCost; } @Override public int stop() { throw new UnsupportedOperationException(); } @Override public int round() { return 1 + numberOfTransfers + egress.numberOfRides(); } @Override public int arrivalTime() { return arrivalTime; } @Override public int cost() { return cost; } @Override public ArrivalView previous() { return previous; } @Override public boolean arrivedAtDestination() { return true; } @Override public EgressPathView egressPath() { return () -> egress; } @Override public String toString() { return asString(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy