-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create template for ContinuousPickupDropOffTrip
- Loading branch information
Hannes Junnila
committed
Oct 6, 2020
1 parent
f28497b
commit 68afe5e
Showing
2 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/ext/java/org/opentripplanner/ext/flex/trip/ContinuousPickupDropOffTrip.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.opentripplanner.ext.flex.trip; | ||
|
||
import org.opentripplanner.ext.flex.FlexServiceDate; | ||
import org.opentripplanner.ext.flex.flexpathcalculator.FlexPathCalculator; | ||
import org.opentripplanner.ext.flex.template.FlexAccessTemplate; | ||
import org.opentripplanner.ext.flex.template.FlexEgressTemplate; | ||
import org.opentripplanner.model.StopLocation; | ||
import org.opentripplanner.model.StopTime; | ||
import org.opentripplanner.model.Trip; | ||
import org.opentripplanner.routing.graphfinder.NearbyStop; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
import static org.opentripplanner.model.StopPattern.PICKDROP_NONE; | ||
|
||
public class ContinuousPickupDropOffTrip extends FlexTrip<Double> { | ||
|
||
public ContinuousPickupDropOffTrip(Trip trip, List<StopTime> stopTimes) {super(trip);} | ||
|
||
public static boolean hasContinuousStops(List<StopTime> stopTimes) { | ||
return stopTimes | ||
.stream() | ||
.anyMatch(st -> st.getFlexContinuousPickup() != PICKDROP_NONE || st.getFlexContinuousDropOff() != PICKDROP_NONE); | ||
} | ||
|
||
@Override | ||
public Stream<FlexAccessTemplate<Double>> getFlexAccessTemplates( | ||
NearbyStop access, FlexServiceDate date, FlexPathCalculator<Integer> calculator | ||
) { | ||
return Stream.empty(); | ||
} | ||
|
||
@Override | ||
public Stream<FlexEgressTemplate<Double>> getFlexEgressTemplates( | ||
NearbyStop egress, FlexServiceDate date, FlexPathCalculator<Integer> calculator | ||
) { | ||
return Stream.empty(); | ||
} | ||
|
||
@Override | ||
public int earliestDepartureTime( | ||
int departureTime, Double fromStopIndex, Double toStopIndex, int flexTime | ||
) { | ||
return departureTime; | ||
} | ||
|
||
@Override | ||
public int latestArrivalTime( | ||
int arrivalTime, Double fromStopIndex, Double toStopIndex, int flexTime | ||
) { | ||
return arrivalTime; | ||
} | ||
|
||
@Override | ||
public Collection<StopLocation> getStops() { | ||
return Collections.EMPTY_LIST; | ||
} | ||
} |