Package org.onebusaway.gtfs.model.calendar

Examples of org.onebusaway.gtfs.model.calendar.ServiceDate


          calendarId.setAgencyId(gtfsAgencyId);
          calendarId.setId(calendar.getId().toString());
       
          c.setServiceId(calendarId);
         
          c.setStartDate(new ServiceDate(snapshotExport.calendarFrom)); // calendar.startDate

          c.setEndDate(new ServiceDate(snapshotExport.calendarTo)); // calendar.endDate
         
          c.setMonday(calendar.monday? 1 : 0);
          c.setTuesday(calendar.tuesday? 1 : 0);
          c.setWednesday(calendar.wednesday? 1 : 0);
          c.setThursday(calendar.thursday? 1 : 0);
          c.setFriday(calendar.friday? 1 : 0);
          c.setSaturday(calendar.saturday? 1 : 0);
          c.setSunday(calendar.sunday? 1 : 0);
       
          store.saveEntity(c);
         
          List<ServiceCalendarDate> calendarDates = ServiceCalendarDate.find("calendar = ?", calendar).fetch();
         
          for(ServiceCalendarDate calendarDate : calendarDates)
          {
            org.onebusaway.gtfs.model.ServiceCalendarDate cDate = new org.onebusaway.gtfs.model.ServiceCalendarDate();
           
            cDate.setServiceId(calendarId);
           
            cDate.setDate(new ServiceDate(calendarDate.date));
           
            cDate.setExceptionType(calendarDate.exceptionType == ServiceCalendarDateType.ADDED? 1 : 0);
           
            store.saveEntity(cDate);
          }
View Full Code Here


          if (date.after(endDate))
            break;

          ServiceCalendarDate calendarDate = new ServiceCalendarDate();
          calendarDate.setServiceId(serviceId);
          calendarDate.setDate(new ServiceDate(date));
          calendarDate.setExceptionType(exceptionType);
          _dao.saveEntity(calendarDate);

          c.add(Calendar.DAY_OF_YEAR, 1);
        }
View Full Code Here

  }

  private ServiceDate getServiceDate(Date date) {
    Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"));
    c.setTime(date);
    return new ServiceDate(c);
  }
View Full Code Here

    public LocalDate toJoda() {
        return new LocalDate(year, month, day);
    }

    public ServiceDate toOBA() {
        return new ServiceDate(year, month, day);
    }
View Full Code Here

    private void setServiceDays() {
        Calendar c = Calendar.getInstance();
        c.setTime(new Date(opt.getSecondsSinceEpoch() * 1000));
        c.setTimeZone(graph.getTimeZone());

        final ServiceDate serviceDate = new ServiceDate(c);
        this.serviceDays = new ArrayList<ServiceDay>(3);
        if (calendarService == null && graph.getCalendarService() != null
                && (opt.modes == null || opt.modes.contains(TraverseMode.TRANSIT))) {
            LOG.warn("RoutingContext has no CalendarService. Transit will never be boarded.");
            return;
        }

        for (String agency : graph.getAgencyIds()) {
            addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate.previous(),
                    calendarService, agency));
            addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate, calendarService, agency));
            addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate.next(),
                    calendarService, agency));
        }
    }
View Full Code Here

    /**
     * Wraps the other servicesRunning whose parameter is an OBA ServiceDate.
     * Joda LocalDate is a similar class.
     */
    public BitSet servicesRunning (LocalDate date) {
        return servicesRunning(new ServiceDate(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth()));
    }
View Full Code Here

            if (!tripUpdate.hasTrip()) {
                LOG.warn("Missing TripDescriptor in gtfs-rt trip update: \n{}", tripUpdate);
                continue;
            }

            ServiceDate serviceDate = new ServiceDate();
            TripDescriptor tripDescriptor = tripUpdate.getTrip();

            if (tripDescriptor.hasStartDate()) {
                try {
                    serviceDate = ServiceDate.parseString(tripDescriptor.getStartDate());
View Full Code Here

        return buffer.update(pattern, tripUpdate, agencyId, timeZone, serviceDate);
    }

    protected boolean purgeExpiredData() {
        ServiceDate today = new ServiceDate();
        ServiceDate previously = today.previous().previous(); // Just to be safe...

        if(lastPurgeDate != null && lastPurgeDate.compareTo(previously) > 0) {
            return false;
        }
View Full Code Here

        calendarServiceData.putTimeZoneForAgencyId("Train", timeZone);
        calendarServiceData.putTimeZoneForAgencyId("Ferry", timeZone);

        FareServiceStub fareServiceStub = new FareServiceStub();

        ServiceDate serviceDate = new ServiceDate(1970, 1, 1);

        // Updates for leg 4, the ferry leg
        TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder();

        tripDescriptorBuilder.setTripId("C");
View Full Code Here

        // Revert the graph, thus using the original transfer table again
        reset(graph);
    }

    public void testTimedStopToStopTransfer() throws Exception {
        ServiceDate serviceDate = new ServiceDate(2009, 07, 11);

        // Replace the transfer table with an empty table
        TransferTable table = new TransferTable();
        when(graph.getTransferTable()).thenReturn(table);
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.model.calendar.ServiceDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.