private void readFareRules(GtfsRelationalDao dao) {
Collection<FareRule> rules = dao.getAllFareRules();
for (FareRule rule : rules) {
FareAttribute fare = rule.getFare();
AgencyAndId id = fare.getId();
FareRuleSet fareRule = fareRules.get(id);
if (fareRule == null) {
fareRule = new FareRuleSet();
fareRules.put(id, fareRule);
}
String contains = rule.getContainsId();
if (contains != null) {
fareRule.addContains(contains);
}
String origin = rule.getOriginId();
String destination = rule.getDestinationId();
if (origin != null || destination != null) {
fareRule.addOriginDestination(origin, destination);
}
Route route = rule.getRoute();
if (route != null) {
AgencyAndId routeId = route.getId();
fareRule.addRoute(routeId);
}
}
}