org.opentripplanner.transit.raptor.rangeraptor.standard.stoparrivals.view.Transit 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.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();
}
}