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

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

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

import org.opentripplanner.transit.raptor.api.transit.RaptorTripSchedule;
import org.opentripplanner.transit.raptor.api.view.ArrivalView;
import org.opentripplanner.transit.raptor.api.view.TransitLegView;
import org.opentripplanner.transit.raptor.rangeraptor.standard.stoparrivals.StopArrivalState;

final class Transit
    extends StopArrivalViewAdapter
    implements TransitLegView
{
    private final StopArrivalState arrival;
    private final StopsCursor cursor;

    Transit(int round, int stop, StopArrivalState arrival, StopsCursor cursor) {
        super(round, stop);
        this.arrival = arrival;
        this.cursor = cursor;
    }

    @Override
    public int arrivalTime() {
        return arrival.transitTime();
    }

    @Override
    public boolean arrivedByTransit() {
        return true;
    }

    @Override
    public TransitLegView transitLeg() {
        return this;
    }

    @Override
    public int boardStop() {
        return arrival.boardStop();
    }

    @Override
    public T trip() {
        return arrival.trip();
    }

    @Override
    public ArrivalView previous() {
        return round() == 1
                ? cursor.access(boardStop(), this)
                : cursor.stop(round()-1, boardStop());
    }

    public int boardTime() {
        return arrival.boardTime();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy