-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from conveyal/dev
Bug fix release + new validation checks
- Loading branch information
Showing
35 changed files
with
712 additions
and
113 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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/conveyal/gtfs/validator/FaresValidator.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,26 @@ | ||
package com.conveyal.gtfs.validator; | ||
|
||
import com.conveyal.gtfs.error.NewGTFSErrorType; | ||
import com.conveyal.gtfs.error.SQLErrorStorage; | ||
import com.conveyal.gtfs.loader.Feed; | ||
import com.conveyal.gtfs.model.FareAttribute; | ||
|
||
/** | ||
* Validator for fares that currently just checks that the transfers and transfer_duration fields are harmonious. | ||
*/ | ||
public class FaresValidator extends FeedValidator { | ||
public FaresValidator(Feed feed, SQLErrorStorage errorStorage) { | ||
super(feed, errorStorage); | ||
} | ||
|
||
@Override | ||
public void validate() { | ||
for (FareAttribute fareAttribute : feed.fareAttributes) { | ||
if (fareAttribute.transfers == 0 && fareAttribute.transfer_duration > 0) { | ||
// If a fare does not permit transfers, but defines a duration for which a transfer is valid, register | ||
// an error. | ||
registerError(fareAttribute, NewGTFSErrorType.FARE_TRANSFER_MISMATCH); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.