Search in sources :

Example 1 with OperatingPeriod

use of org.rutebanken.netex.model.OperatingPeriod in project OpenTripPlanner by opentripplanner.

the class NetexImportDataIndexTest method lookupOperatingPeriodById.

@Test
public void lookupOperatingPeriodById() {
    OperatingPeriod value = new OperatingPeriod().withId(ID);
    root.operatingPeriodById.add(value);
    assertEquals(value, child.operatingPeriodById.lookup(ID));
    assertTrue(child.operatingPeriodById.containsKey(ID));
}
Also used : OperatingPeriod(org.rutebanken.netex.model.OperatingPeriod) Test(org.junit.Test)

Example 2 with OperatingPeriod

use of org.rutebanken.netex.model.OperatingPeriod in project OpenTripPlanner by opentripplanner.

the class NetexImportDataIndex method readOnlyView.

public NetexImportDataIndexReadOnlyView readOnlyView() {
    return new NetexImportDataIndexReadOnlyView() {

        /**
         * Lookup a Network given a GroupOfLine id or an Network id. If the given
         * {@code groupOfLineOrNetworkId} is a GroupOfLine ID, we lookup the GroupOfLine, and then
         * lookup its Network. If the given {@code groupOfLineOrNetworkId} is a Network ID then we
         * can lookup the Network directly.
         * <p/>
         * If no Network is found {@code null} is returned.
         */
        public Network lookupNetworkForLine(String groupOfLineOrNetworkId) {
            GroupOfLines groupOfLines = groupOfLinesById.lookup(groupOfLineOrNetworkId);
            String networkId = groupOfLines == null ? groupOfLineOrNetworkId : networkIdByGroupOfLineId.lookup(groupOfLines.getId());
            return networkById.lookup(networkId);
        }

        public ReadOnlyHierarchicalMapById<Authority> getAuthoritiesById() {
            return authoritiesById;
        }

        public ReadOnlyHierarchicalMapById<DayType> getDayTypeById() {
            return dayTypeById;
        }

        public ReadOnlyHierarchicalMap<String, Collection<DayTypeAssignment>> getDayTypeAssignmentByDayTypeId() {
            return dayTypeAssignmentByDayTypeId;
        }

        public Iterable<DayTypeRefsToServiceIdAdapter> getDayTypeRefs() {
            return Collections.unmodifiableSet(dayTypeRefs);
        }

        public ReadOnlyHierarchicalMapById<DestinationDisplay> getDestinationDisplayById() {
            return destinationDisplayById;
        }

        public ReadOnlyHierarchicalMapById<GroupOfStopPlaces> getGroupOfStopPlacesById() {
            return groupOfStopPlacesById;
        }

        public ReadOnlyHierarchicalMapById<JourneyPattern> getJourneyPatternsById() {
            return journeyPatternsById;
        }

        public ReadOnlyHierarchicalMapById<Line> getLineById() {
            return lineById;
        }

        public ReadOnlyHierarchicalMapById<StopPlace> getMultiModalStopPlaceById() {
            return multiModalStopPlaceById;
        }

        public ReadOnlyHierarchicalMapById<Notice> getNoticeById() {
            return noticeById;
        }

        public ReadOnlyHierarchicalMapById<NoticeAssignment> getNoticeAssignmentById() {
            return noticeAssignmentById;
        }

        public ReadOnlyHierarchicalMapById<OperatingPeriod> getOperatingPeriodById() {
            return operatingPeriodById;
        }

        public ReadOnlyHierarchicalMapById<Operator> getOperatorsById() {
            return operatorsById;
        }

        public ReadOnlyHierarchicalMap<String, Collection<TimetabledPassingTime>> getPassingTimeByStopPointId() {
            return passingTimeByStopPointId;
        }

        public ReadOnlyHierarchicalVersionMapById<Quay> getQuayById() {
            return quayById;
        }

        public ReadOnlyHierarchicalMap<String, String> getQuayIdByStopPointRef() {
            return quayIdByStopPointRef;
        }

        public ReadOnlyHierarchicalMapById<Route> getRouteById() {
            return routeById;
        }

        public ReadOnlyHierarchicalMap<String, Collection<ServiceJourney>> getServiceJourneyByPatternId() {
            return serviceJourneyByPatternId;
        }

        public ReadOnlyHierarchicalMapById<ServiceLink> getServiceLinkById() {
            return serviceLinkById;
        }

        public ReadOnlyHierarchicalVersionMapById<StopPlace> getStopPlaceById() {
            return stopPlaceById;
        }

        public ReadOnlyHierarchicalMapById<TariffZone> getTariffZonesById() {
            return tariffZonesById;
        }

        public String getTimeZone() {
            return timeZone.get();
        }
    };
}
Also used : Operator(org.rutebanken.netex.model.Operator) StopPlace(org.rutebanken.netex.model.StopPlace) TariffZone(org.rutebanken.netex.model.TariffZone) DestinationDisplay(org.rutebanken.netex.model.DestinationDisplay) GroupOfStopPlaces(org.rutebanken.netex.model.GroupOfStopPlaces) Authority(org.rutebanken.netex.model.Authority) DayType(org.rutebanken.netex.model.DayType) GroupOfLines(org.rutebanken.netex.model.GroupOfLines) Line(org.rutebanken.netex.model.Line) JourneyPattern(org.rutebanken.netex.model.JourneyPattern) Notice(org.rutebanken.netex.model.Notice) DayTypeRefsToServiceIdAdapter(org.opentripplanner.netex.support.DayTypeRefsToServiceIdAdapter) OperatingPeriod(org.rutebanken.netex.model.OperatingPeriod) Collection(java.util.Collection) NoticeAssignment(org.rutebanken.netex.model.NoticeAssignment) Quay(org.rutebanken.netex.model.Quay) ServiceLink(org.rutebanken.netex.model.ServiceLink) Route(org.rutebanken.netex.model.Route)

Example 3 with OperatingPeriod

use of org.rutebanken.netex.model.OperatingPeriod in project OpenTripPlanner by opentripplanner.

the class DayTypeAssignmentMapper method addOperationPeriod.

private void addOperationPeriod(DayTypeAssignment dayTypeAssignment) {
    boolean isAvailable = isDayTypeAvailableForAssigment(dayTypeAssignment);
    String ref = dayTypeAssignment.getOperatingPeriodRef().getRef();
    OperatingPeriod period = operatingPeriodById.lookup(ref);
    if (period != null) {
        Set<DayOfWeek> daysOfWeek = daysOfWeekForDayType(dayTypeById.lookup(dayTypeId));
        // Plus 1 to make the end date exclusive - simplify the loop test
        LocalDateTime endDate = period.getToDate().plusDays(1);
        LocalDateTime date = period.getFromDate();
        for (; date.isBefore(endDate); date = date.plusDays(1)) {
            if (daysOfWeek.contains(date.getDayOfWeek())) {
                addDate(isAvailable, date);
            }
        }
    }
}
Also used : LocalDateTime(java.time.LocalDateTime) DayOfWeek(java.time.DayOfWeek) OperatingPeriod(org.rutebanken.netex.model.OperatingPeriod)

Aggregations

OperatingPeriod (org.rutebanken.netex.model.OperatingPeriod)3 DayOfWeek (java.time.DayOfWeek)1 LocalDateTime (java.time.LocalDateTime)1 Collection (java.util.Collection)1 Test (org.junit.Test)1 DayTypeRefsToServiceIdAdapter (org.opentripplanner.netex.support.DayTypeRefsToServiceIdAdapter)1 Authority (org.rutebanken.netex.model.Authority)1 DayType (org.rutebanken.netex.model.DayType)1 DestinationDisplay (org.rutebanken.netex.model.DestinationDisplay)1 GroupOfLines (org.rutebanken.netex.model.GroupOfLines)1 GroupOfStopPlaces (org.rutebanken.netex.model.GroupOfStopPlaces)1 JourneyPattern (org.rutebanken.netex.model.JourneyPattern)1 Line (org.rutebanken.netex.model.Line)1 Notice (org.rutebanken.netex.model.Notice)1 NoticeAssignment (org.rutebanken.netex.model.NoticeAssignment)1 Operator (org.rutebanken.netex.model.Operator)1 Quay (org.rutebanken.netex.model.Quay)1 Route (org.rutebanken.netex.model.Route)1 ServiceLink (org.rutebanken.netex.model.ServiceLink)1 StopPlace (org.rutebanken.netex.model.StopPlace)1