Search in sources :

Example 1 with FareRule

use of org.opentripplanner.model.FareRule in project OpenTripPlanner by opentripplanner.

the class FareRuleMapper method doMap.

private FareRule doMap(org.onebusaway.gtfs.model.FareRule rhs) {
    FareRule lhs = new FareRule();
    lhs.setFare(fareAttributeMapper.map(rhs.getFare()));
    lhs.setRoute(routeMapper.map(rhs.getRoute()));
    lhs.setOriginId(rhs.getOriginId());
    lhs.setDestinationId(rhs.getDestinationId());
    lhs.setContainsId(rhs.getContainsId());
    return lhs;
}
Also used : FareRule(org.opentripplanner.model.FareRule)

Example 2 with FareRule

use of org.opentripplanner.model.FareRule in project OpenTripPlanner by opentripplanner.

the class OtpTransitServiceImplTest method createFareRule.

private static FareRule createFareRule() {
    FareAttribute fa = new FareAttribute();
    fa.setId(new FeedScopedId(FEED_ID, "FA"));
    FareRule rule = new FareRule();
    rule.setOriginId("Zone A");
    rule.setContainsId("Zone B");
    rule.setDestinationId("Zone C");
    rule.setFare(fa);
    return rule;
}
Also used : FareAttribute(org.opentripplanner.model.FareAttribute) FareRule(org.opentripplanner.model.FareRule) FeedScopedId(org.opentripplanner.model.FeedScopedId)

Example 3 with FareRule

use of org.opentripplanner.model.FareRule in project OpenTripPlanner by opentripplanner.

the class OtpTransitServiceImplTest method setup.

@BeforeClass
public static void setup() throws IOException {
    GtfsContextBuilder contextBuilder = contextBuilder(FEED_ID, ConstantsForTests.FAKE_GTFS);
    OtpTransitServiceBuilder builder = contextBuilder.getTransitBuilder();
    agency = first(builder.getAgenciesById().values());
    // Supplement test data with at least one entity in all collections
    FareRule rule = createFareRule();
    builder.getFareAttributes().add(rule.getFare());
    builder.getFareRules().add(rule);
    builder.getFeedInfos().add(new FeedInfo());
    subject = builder.build();
}
Also used : GtfsContextBuilder(org.opentripplanner.gtfs.GtfsContextBuilder) FareRule(org.opentripplanner.model.FareRule) FeedInfo(org.opentripplanner.model.FeedInfo) BeforeClass(org.junit.BeforeClass)

Example 4 with FareRule

use of org.opentripplanner.model.FareRule in project OpenTripPlanner by opentripplanner.

the class CalendarServiceDataFactoryImplTest method createCtxBuilder.

private static GtfsContext createCtxBuilder() throws IOException {
    GtfsContextBuilder ctxBuilder = contextBuilder(FEED_ID, ConstantsForTests.FAKE_GTFS);
    OtpTransitServiceBuilder builder = ctxBuilder.withDataImportIssueStore(new DataImportIssueStore(false)).getTransitBuilder();
    Agency agency = agency(builder);
    // Supplement test data with at least one entity in all collections
    builder.getCalendarDates().add(removeMondayFromAlldays());
    builder.getFareAttributes().add(createFareAttribute(agency));
    builder.getFareRules().add(new FareRule());
    builder.getFeedInfos().add(new FeedInfo());
    return ctxBuilder.build();
}
Also used : OtpTransitServiceBuilder(org.opentripplanner.model.impl.OtpTransitServiceBuilder) Agency(org.opentripplanner.model.Agency) GtfsContextBuilder(org.opentripplanner.gtfs.GtfsContextBuilder) FareRule(org.opentripplanner.model.FareRule) FeedInfo(org.opentripplanner.model.FeedInfo) DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore)

Example 5 with FareRule

use of org.opentripplanner.model.FareRule in project OpenTripPlanner by opentripplanner.

the class OtpTransitServiceBuilderTest method createBuilder.

/* private methods */
private static OtpTransitServiceBuilder createBuilder() throws IOException {
    OtpTransitServiceBuilder builder = contextBuilder(FEED_ID, ConstantsForTests.FAKE_GTFS).getTransitBuilder();
    Agency agency = agency(builder);
    // Supplement test data with at least one entity in all collections
    builder.getCalendarDates().add(createAServiceCalendarDateExclution(SERVICE_WEEKDAYS_ID));
    builder.getFareAttributes().add(createFareAttribute(agency));
    builder.getFareRules().add(new FareRule());
    builder.getFeedInfos().add(new FeedInfo());
    return builder;
}
Also used : Agency(org.opentripplanner.model.Agency) FareRule(org.opentripplanner.model.FareRule) FeedInfo(org.opentripplanner.model.FeedInfo)

Aggregations

FareRule (org.opentripplanner.model.FareRule)6 FeedInfo (org.opentripplanner.model.FeedInfo)3 GtfsContextBuilder (org.opentripplanner.gtfs.GtfsContextBuilder)2 Agency (org.opentripplanner.model.Agency)2 FareAttribute (org.opentripplanner.model.FareAttribute)2 FeedScopedId (org.opentripplanner.model.FeedScopedId)2 BeforeClass (org.junit.BeforeClass)1 DataImportIssueStore (org.opentripplanner.graph_builder.DataImportIssueStore)1 Route (org.opentripplanner.model.Route)1 OtpTransitServiceBuilder (org.opentripplanner.model.impl.OtpTransitServiceBuilder)1 FareRuleSet (org.opentripplanner.routing.core.FareRuleSet)1