-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add a matcher API for filters in the transit service used for route lookup #6378
base: dev-2.x
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6378 +/- ##
=============================================
+ Coverage 69.80% 69.85% +0.04%
- Complexity 17943 17977 +34
=============================================
Files 2046 2051 +5
Lines 76671 76731 +60
Branches 7830 7827 -3
=============================================
+ Hits 53521 53599 +78
+ Misses 20408 20389 -19
- Partials 2742 2743 +1 ☔ View full report in Codecov by Sentry. |
public Collection<Route> getRoutes(Collection<FeedScopedId> id) { | ||
return id.stream().map(this::getRoute).filter(Objects::nonNull).toList(); | ||
} |
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.
public Collection<Route> getRoutes(Collection<FeedScopedId> id) { | |
return id.stream().map(this::getRoute).filter(Objects::nonNull).toList(); | |
} | |
public Collection<Route> getRoutes(Collection<FeedScopedId> ids) { | |
return ids.stream().map(this::getRoute).filter(Objects::nonNull).toList(); | |
} |
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.
Sorry was a bit confused by the variable name.
new I18NString() { | ||
@Override | ||
public String toString() { | ||
return "ROUTE1LONG"; | ||
} | ||
|
||
@Override | ||
public String toString(Locale locale) { | ||
return "ROUTE1LONG"; | ||
} | ||
} | ||
) |
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.
new I18NString() { | |
@Override | |
public String toString() { | |
return "ROUTE1LONG"; | |
} | |
@Override | |
public String toString(Locale locale) { | |
return "ROUTE1LONG"; | |
} | |
} | |
) | |
I28NString.of("ROUTE1") |
What is the reason you went for your own implementation?
new I18NString() { | ||
@Override | ||
public String toString() { | ||
return "ROUTE2LONG"; | ||
} | ||
|
||
@Override | ||
public String toString(Locale locale) { | ||
return "ROUTE2LONG"; | ||
} | ||
} |
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.
Same here.
Agency | ||
.of(new FeedScopedId("otherFeedId", "otherAgencyId")) | ||
.withName("OTHER_AGENCY") | ||
.withTimezone("Europe/Oslo") | ||
.build() |
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.
You may find TimetableRepositoryForTest.agency
useful.
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.
The main code looks very neat but I have a few comments about the test code.
Summary
This change allows for a clean separation of concerns and lays the path for more efficient filtering logic down the line.
The functionality is backwards compatible, though there may be a discussion here that it should not be and that we should instead improve on some of the choices made earlier. For instance whether the longName check should really be a case insensitive prefix match.
Issue
#5630
Unit tests
Added unit tests for each matcher and the new RegularStopMatcherFactory. Also ensured that the API in local runs behaves as expected.
Documentation
Added JavaDoc.