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

org.opentripplanner.transit.raptor.rangeraptor.standard.stoparrivals.EgressStopArrivalState Maven / Gradle / Ivy

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

import org.opentripplanner.transit.raptor.api.transit.RaptorTransfer;
import org.opentripplanner.transit.raptor.api.transit.RaptorTripSchedule;

import java.util.function.Consumer;

/**
 * The egress stop arrival state is responsible for sending arrival notifications.
 * This is used to update the destination arrivals.
 *
 * @param  The TripSchedule type defined by the user of the raptor API.
 */
public final class EgressStopArrivalState extends StopArrivalState {
    private final int round;
    private final RaptorTransfer egressLeg;
    private final Consumer> transitCallback;

    EgressStopArrivalState(int round, RaptorTransfer egressLeg, Consumer> transitCallback) {
        this.round = round;
        this.egressLeg = egressLeg;
        this.transitCallback = transitCallback;
    }

    public int round() {
        return round;
    }

    public int stop() {
        return egressLeg.stop();
    }


    public final RaptorTransfer egressLeg() {
        return egressLeg;
    }

    @Override
    public void arriveByTransit(int time, int boardStop, int boardTime, T trip) {
        super.arriveByTransit(time, boardStop, boardTime, trip);
        transitCallback.accept(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy