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

org.opentripplanner.transit.raptor.rangeraptor.multicriteria.CalculateTransferToDestination Maven / Gradle / Ivy

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

import java.util.List;
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.rangeraptor.path.DestinationArrivalPaths;
import org.opentripplanner.transit.raptor.util.paretoset.ParetoSetEventListener;

/**
 * This class listen to pareto set egress stop arrivals and on accepted
 * transit arrivals make the transfer to the destination.
 *
 * @param  The TripSchedule type defined by the user of the raptor API.
 */
public class CalculateTransferToDestination
        implements ParetoSetEventListener> {

    private final List egressPaths;
    private final DestinationArrivalPaths destinationArrivals;

    CalculateTransferToDestination(
            List egressPaths,
            DestinationArrivalPaths destinationArrivals
    ) {
        this.egressPaths = egressPaths;
        this.destinationArrivals = destinationArrivals;
    }

    /**
     * When a stop arrival is accepted and we arrived by transit, then add a new destination arrival.
     * 

* We do not have to handle other events like dropped or rejected. * * @param newElement the new transit arrival */ @Override public void notifyElementAccepted(ArrivalView newElement) { if(newElement.arrivedByTransit()) { for (RaptorTransfer egress : egressPaths) { destinationArrivals.add(newElement, egress); } } else if (newElement.arrivedByTransfer()) { for (RaptorTransfer egress : egressPaths) { if (egress.stopReachedOnBoard()) { destinationArrivals.add(newElement, egress); } } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy