-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Changes to TransitDataProviderFilter #6850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a25a5b3
2dc5c01
37333c9
83886da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,8 +3,9 @@ | |||||
| import java.util.BitSet; | ||||||
| import java.util.List; | ||||||
| import java.util.Set; | ||||||
| import java.util.function.Predicate; | ||||||
| import javax.annotation.Nullable; | ||||||
| import org.opentripplanner.model.PickDrop; | ||||||
| import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; | ||||||
| import org.opentripplanner.routing.api.request.RouteRequest; | ||||||
| import org.opentripplanner.routing.api.request.StreetMode; | ||||||
| import org.opentripplanner.routing.api.request.preference.WheelchairPreferences; | ||||||
|
|
@@ -14,6 +15,7 @@ | |||||
| import org.opentripplanner.transit.model.network.BikeAccess; | ||||||
| import org.opentripplanner.transit.model.network.CarAccess; | ||||||
| import org.opentripplanner.transit.model.network.RoutingTripPattern; | ||||||
| import org.opentripplanner.transit.model.network.TripPattern; | ||||||
| import org.opentripplanner.transit.model.timetable.Trip; | ||||||
| import org.opentripplanner.transit.model.timetable.TripTimes; | ||||||
|
|
||||||
|
|
@@ -76,11 +78,6 @@ public RouteRequestTransitDataProviderFilter( | |||||
| this.hasSubModeFilters = filters.stream().anyMatch(TransitFilter::isSubModePredicate); | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| public boolean hasSubModeFilters() { | ||||||
| return hasSubModeFilters; | ||||||
| } | ||||||
|
|
||||||
| public static BikeAccess bikeAccessForTrip(Trip trip) { | ||||||
| if (trip.getBikesAllowed() != BikeAccess.UNKNOWN) { | ||||||
| return trip.getBikesAllowed(); | ||||||
|
|
@@ -90,17 +87,18 @@ public static BikeAccess bikeAccessForTrip(Trip trip) { | |||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| public boolean tripPatternPredicate(TripPatternForDate tripPatternForDate) { | ||||||
| @Nullable | ||||||
| public Predicate<TripTimes> getTripFilter(TripPattern tripPattern) { | ||||||
| for (TransitFilter filter : filters) { | ||||||
| if (filter.matchTripPattern(tripPatternForDate.getTripPattern().getPattern())) { | ||||||
| return true; | ||||||
| if (filter.matchTripPattern(tripPattern)) { | ||||||
| var withFilters = hasSubModeFilters && tripPattern.getContainsMultipleModes(); | ||||||
|
||||||
| return tripTimes -> this.tripTimesPredicate(tripTimes, withFilters); | ||||||
|
||||||
| return tripTimes -> this.tripTimesPredicate(tripTimes, withFilters); | |
| return tripTimes ->tripTimesPredicate(tripTimes, withFilters); |
Avoid using this. unless it is needed.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming: withFilters see above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming this to
createTripFilter