Skip to content

Commit

Permalink
Merge 3a8838d into 01b7539
Browse files Browse the repository at this point in the history
  • Loading branch information
qcdyx authored Oct 15, 2024
2 parents 01b7539 + 3a8838d commit 0811ba4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,20 @@ public class FeedMetadata {
private final List<Pair<FeatureMetadata, String>> FILE_BASED_FEATURES =
List.of(
new Pair<>(new FeatureMetadata("Pathway Connections", "Pathways"), GtfsPathway.FILENAME),
new Pair<>(new FeatureMetadata("Pathway Signs", "Pathways"), GtfsPathway.FILENAME),
new Pair<>(new FeatureMetadata("Pathway Details", "Pathways"), GtfsPathway.FILENAME),
new Pair<>(new FeatureMetadata("Levels", "Pathways"), GtfsLevel.FILENAME),
new Pair<>(new FeatureMetadata("Transfers", null), GtfsTransfer.FILENAME),
new Pair<>(new FeatureMetadata("Shapes", null), GtfsShape.FILENAME),
new Pair<>(new FeatureMetadata("Frequency-Based Service", null), GtfsFrequency.FILENAME),
new Pair<>(new FeatureMetadata("Frequencies", null), GtfsFrequency.FILENAME),
new Pair<>(new FeatureMetadata("Feed Information", null), GtfsFeedInfo.FILENAME),
new Pair<>(new FeatureMetadata("Attributions", null), GtfsAttribution.FILENAME),
new Pair<>(new FeatureMetadata("Translations", null), GtfsTranslation.FILENAME),
new Pair<>(new FeatureMetadata("Fares V1", "Fares"), GtfsFareAttribute.FILENAME),
new Pair<>(new FeatureMetadata("Fare Products", "Fares"), GtfsFareProduct.FILENAME),
new Pair<>(new FeatureMetadata("Fare Media", "Fares"), GtfsFareMedia.FILENAME),
new Pair<>(new FeatureMetadata("Zone-Based Fares", "Fares"), GtfsArea.FILENAME),
new Pair<>(
new FeatureMetadata("Fares Transfers", "Fares"), GtfsFareTransferRule.FILENAME),
new Pair<>(new FeatureMetadata("Fare Transfers", "Fares"), GtfsFareTransferRule.FILENAME),
new Pair<>(new FeatureMetadata("Time-Based Fares", "Fares"), GtfsTimeframe.FILENAME),
new Pair<>(
new FeatureMetadata("Booking Rules", "Flexible Services"), GtfsBookingRules.FILENAME),
Expand Down Expand Up @@ -185,8 +186,9 @@ private void loadSpecFeaturesBasedOnFieldPresence(GtfsFeedContainer feedContaine
loadBikeAllowanceFeature(feedContainer);
loadLocationTypesFeature(feedContainer);
loadTraversalTimeFeature(feedContainer);
loadPathwayDirectionsFeature(feedContainer);
loadPathwayExtraFeature(feedContainer);
loadPathwaySignsFeature(feedContainer);
loadPathwayDetailsFeature(feedContainer);
loadPathwayConnectionsFeature(feedContainer);
loadRouteBasedFaresFeature(feedContainer);
loadContinuousStopsFeature(feedContainer);
loadZoneBasedDemandResponsiveTransitFeature(feedContainer);
Expand Down Expand Up @@ -289,18 +291,20 @@ private void loadRouteBasedFaresFeature(GtfsFeedContainer feedContainer) {
|| hasAtLeastOneRecordInFile(feedContainer, GtfsNetwork.FILENAME));
}

private void loadPathwayDirectionsFeature(GtfsFeedContainer feedContainer) {
private void loadPathwaySignsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
new FeatureMetadata("Pathway Signs", "Pathways"),
hasAtLeastOneRecordForFields(
feedContainer,
GtfsPathway.FILENAME,
List.of(
GtfsPathway::hasSignpostedAs,
(Function<GtfsPathway, Boolean>) GtfsPathway::hasReversedSignpostedAs)));
feedContainer,
GtfsPathway.FILENAME,
List.of((Function<GtfsPathway, Boolean>) GtfsPathway::hasSignpostedAs))
|| hasAtLeastOneRecordForFields(
feedContainer,
GtfsPathway.FILENAME,
List.of((Function<GtfsPathway, Boolean>) GtfsPathway::hasReversedSignpostedAs)));
}

private void loadPathwayExtraFeature(GtfsFeedContainer feedContainer) {
private void loadPathwayDetailsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
new FeatureMetadata("Pathway Details", "Pathways"),
hasAtLeastOneRecordForFields(
Expand All @@ -321,6 +325,12 @@ private void loadPathwayExtraFeature(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsPathway, Boolean>) GtfsPathway::hasStairCount)));
}

private void loadPathwayConnectionsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
new FeatureMetadata("Pathway Connections", "Pathways"),
hasAtLeastOneRecordInFile(feedContainer, GtfsPathway.FILENAME));
}

private void loadTraversalTimeFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
new FeatureMetadata("In-station Traversal Time", "Pathways"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public void containsFrequencyBasedTripFeatureTest() throws IOException, Interrup
"trip_id, start_time, end_time, headway_secs\n" + "dummy1, 01:01:01, 01:01:02, 1\n";
createDataFile(GtfsFrequency.FILENAME, content);
validateSpecFeature(
"Frequency-Based Service",
"Frequencies",
true,
ImmutableList.of(GtfsFrequencyTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}
Expand All @@ -341,7 +341,7 @@ public void omitsFrequencyBasedTripFeatureTest() throws IOException, Interrupted
String content = "trip_id, start_time, end_time, headway_secs\n";
createDataFile(GtfsFrequency.FILENAME, content);
validateSpecFeature(
"Frequency-Based Service",
"Frequencies",
false,
ImmutableList.of(GtfsFrequencyTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}
Expand Down

0 comments on commit 0811ba4

Please sign in to comment.