當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceCalendar類代碼示例

本文整理匯總了Java中org.onebusaway.gtfs.model.ServiceCalendar的典型用法代碼示例。如果您正苦於以下問題:Java ServiceCalendar類的具體用法?Java ServiceCalendar怎麽用?Java ServiceCalendar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ServiceCalendar類屬於org.onebusaway.gtfs.model包,在下文中一共展示了ServiceCalendar類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEntityClasses

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public static List<Class<?>> getEntityClasses() {
  List<Class<?>> entityClasses = new ArrayList<Class<?>>();
  entityClasses.add(FeedInfo.class);
  entityClasses.add(Agency.class);
  entityClasses.add(Block.class);
  entityClasses.add(ShapePoint.class);
  entityClasses.add(Route.class);
  entityClasses.add(Stop.class);
  entityClasses.add(Trip.class);
  entityClasses.add(StopTime.class);
  entityClasses.add(ServiceCalendar.class);
  entityClasses.add(ServiceCalendarDate.class);
  entityClasses.add(FareAttribute.class);
  entityClasses.add(FareRule.class);
  entityClasses.add(Frequency.class);
  entityClasses.add(Pathway.class);
  entityClasses.add(Transfer.class);
  return entityClasses;
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:20,代碼來源:GtfsEntitySchemaFactory.java

示例2: getEntityComparators

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public static Map<Class<?>, Comparator<?>> getEntityComparators() {
  Map<Class<?>, Comparator<?>> comparators = new HashMap<Class<?>, Comparator<?>>();
  comparators.put(Agency.class,
      getComparatorForIdentityBeanType(Agency.class));
  comparators.put(Block.class,
      getComparatorForIdentityBeanType(Block.class));
  comparators.put(Route.class, getComparatorForIdentityBeanType(Route.class));
  comparators.put(Stop.class, getComparatorForIdentityBeanType(Stop.class));
  comparators.put(Trip.class, getComparatorForIdentityBeanType(Trip.class));
  comparators.put(StopTime.class, new StopTimeComparator());
  comparators.put(ShapePoint.class, new ShapePointComparator());
  comparators.put(ServiceCalendar.class, new ServiceCalendarComparator());
  comparators.put(ServiceCalendarDate.class,
      new ServiceCalendarDateComparator());
  return comparators;
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:17,代碼來源:GtfsEntitySchemaFactory.java

示例3: testDaylightSavingTime

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Test
public void testDaylightSavingTime() {

  CalendarServiceDataFactoryImpl factory = new CalendarServiceDataFactoryImpl();

  Agency agencyA = agency("A", "America/Los_Angeles");
  AgencyAndId serviceId = new AgencyAndId("A", "2");

  ServiceDate dStart = new ServiceDate(2012, 3, 1);
  ServiceDate dEnd = new ServiceDate(2012, 3, 31);

  ServiceCalendar c = calendar(serviceId, dStart, dEnd, "1111111");

  GtfsRelationalDaoImpl dao = new GtfsRelationalDaoImpl();
  factory.setGtfsDao(dao);

  saveEntities(dao, agencyA);
  saveEntities(dao, c);

  CalendarServiceData data = factory.createData();
  List<ServiceDate> serviceDates = data.getServiceDatesForServiceId(serviceId);
  assertTrue(serviceDates.contains(new ServiceDate(2012, 3, 11)));
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:24,代碼來源:CalendarServiceDataFactoryImplSyntheticTest.java

示例4: getCalendarServiceRangeStart

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public Date getCalendarServiceRangeStart() {

		Date startDate = null;

		for (ServiceCalendar serviceCalendar : gtfsDao.getAllCalendars()) {

			if (startDate == null
					|| serviceCalendar.getStartDate().getAsDate().before(startDate))
				startDate = serviceCalendar.getStartDate().getAsDate();
		}
		if (startDate != null){
			return startDate;
		} else {
			// an exception here means that there are no dates in the feed at all
			return getCalendarDateStart().orElseThrow(IllegalStateException::new); 
	}

	}
 
開發者ID:conveyal,項目名稱:gtfs-validator,代碼行數:19,代碼來源:GtfsStatisticsService.java

示例5: dumpToWriter

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public void dumpToWriter(GtfsWriter gtfsWriter) {
    for(Agency agency : agencies){
    	gtfsWriter.handleEntity( agency );
    }
    for(Route route : routes){
    	gtfsWriter.handleEntity(route);
    }
    for(Trip trip : trips){
    	gtfsWriter.handleEntity(trip);
    }
    for(Stop stop : stops){
    	gtfsWriter.handleEntity(stop);
    }
    for(StopTime stoptime : stoptimes){
    	gtfsWriter.handleEntity(stoptime);
    }
    for(Frequency fr : frequencies){
    	gtfsWriter.handleEntity(fr);
    }
    for(ServiceCalendar sc : calendars){
    	gtfsWriter.handleEntity(sc);
    }
}
 
開發者ID:conveyal,項目名稱:geom2gtfs,代碼行數:24,代碼來源:GtfsQueue.java

示例6: getCalendarForServiceId

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Override
public ServiceCalendar getCalendarForServiceId(AgencyAndId serviceId) {

  List<ServiceCalendar> calendars = _ops.findByNamedQueryAndNamedParam(
      "calendarsForServiceId", "serviceId", serviceId);

  switch (calendars.size()) {
    case 0:
      return null;
    case 1:
      return calendars.get(0);
  }

  throw new MultipleCalendarsForServiceIdException(serviceId);
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:16,代碼來源:HibernateGtfsRelationalDaoImpl.java

示例7: testGetAllCalendars

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Test
public void testGetAllCalendars() throws ParseException {

  List<ServiceCalendar> calendars = _dao.getAllCalendars();
  assertEquals(6, calendars.size());

  List<ServiceCalendar> weekdays = grep(calendars,
      new Filter<ServiceCalendar>() {
        @Override
        public boolean isEnabled(ServiceCalendar object) {
          return object.getServiceId().equals(aid("WD"));
        }
      });

  assertEquals(1, weekdays.size());
  ServiceCalendar weekday = weekdays.get(0);

  assertEquals(new ServiceDate(2009,1,1), weekday.getStartDate());
  assertEquals(new ServiceDate(2009,3,1), weekday.getEndDate());
  assertEquals(1, weekday.getMonday());
  assertEquals(1, weekday.getTuesday());
  assertEquals(1, weekday.getWednesday());
  assertEquals(1, weekday.getThursday());
  assertEquals(1, weekday.getFriday());
  assertEquals(0, weekday.getSaturday());
  assertEquals(0, weekday.getSunday());
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:28,代碼來源:HibernateGtfsRelationalDaoImplCaltrainTest.java

示例8: testCalendarForServiceId

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Test
public void testCalendarForServiceId() {

  ServiceCalendar calendar = _dao.getCalendarForServiceId(new AgencyAndId(
      "BART", "WKDY"));
  assertEquals(new ServiceDate(2007, 1, 1), calendar.getStartDate());
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:8,代碼來源:HibernateGtfsRelationalImplBartTest.java

示例9: GtfsReader

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public GtfsReader() {

    _entityClasses.add(Agency.class);
    _entityClasses.add(Block.class);
    _entityClasses.add(ShapePoint.class);
    _entityClasses.add(Route.class);
    _entityClasses.add(Stop.class);
    _entityClasses.add(Trip.class);
    _entityClasses.add(StopTime.class);
    _entityClasses.add(ServiceCalendar.class);
    _entityClasses.add(ServiceCalendarDate.class);
    _entityClasses.add(FareAttribute.class);
    _entityClasses.add(FareRule.class);
    _entityClasses.add(Frequency.class);
    _entityClasses.add(Pathway.class);
    _entityClasses.add(Transfer.class);
    _entityClasses.add(FeedInfo.class);

    CsvTokenizerStrategy tokenizerStrategy = new CsvTokenizerStrategy();
    tokenizerStrategy.getCsvParser().setTrimInitialWhitespace(true);
    setTokenizerStrategy(tokenizerStrategy);
    
    setTrimValues(true);

    /**
     * Prep the Entity Schema Factories
     */
    DefaultEntitySchemaFactory schemaFactory = createEntitySchemaFactory();
    setEntitySchemaFactory(schemaFactory);

    CsvEntityContext ctx = getContext();
    ctx.put(KEY_CONTEXT, _context);

    addEntityHandler(new EntityHandlerImpl());
  }
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:36,代碼來源:GtfsReader.java

示例10: getCalendarForServiceId

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Override
public ServiceCalendar getCalendarForServiceId(AgencyAndId serviceId) {
  ensureCalendarsByServiceIdRelation();
  List<ServiceCalendar> calendars = list(_calendarsByServiceId.get(serviceId));
  switch (calendars.size()) {
    case 0:
      return null;
    case 1:
      return calendars.get(0);
  }
  throw new MultipleCalendarsForServiceIdException(serviceId);
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:13,代碼來源:GtfsRelationalDaoImpl.java

示例11: getServiceDatesForServiceId

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public Set<ServiceDate> getServiceDatesForServiceId(AgencyAndId serviceId,
    TimeZone serviceIdTimeZone) {
  Set<ServiceDate> activeDates = new HashSet<ServiceDate>();
  ServiceCalendar c = _dao.getCalendarForServiceId(serviceId);

  if (c != null) {
    addDatesFromCalendar(c, serviceIdTimeZone, activeDates);
  }
  for (ServiceCalendarDate cd : _dao.getCalendarDatesForServiceId(serviceId)) {
    addAndRemoveDatesFromCalendarDate(cd, serviceIdTimeZone, activeDates);
  }
  return activeDates;
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:14,代碼來源:CalendarServiceDataFactoryImpl.java

示例12: getCalendarServiceRangeEnd

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
public Date getCalendarServiceRangeEnd() {

		Date endDate = null;

		for (ServiceCalendar serviceCalendar : gtfsDao.getAllCalendars()) {
			if (endDate == null
          || serviceCalendar.getEndDate().getAsDate().after(endDate))
        endDate = serviceCalendar.getEndDate().getAsDate();
		}
		if (endDate != null){
		return endDate;
		} else {
			return getCalendarDateEnd().orElseThrow(IllegalStateException::new);
		}
	}
 
開發者ID:conveyal,項目名稱:gtfs-validator,代碼行數:16,代碼來源:GtfsStatisticsService.java

示例13: getAllCalendars

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Override
public List<ServiceCalendar> getAllCalendars() {
  return _ops.find("FROM ServiceCalendar");
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:5,代碼來源:HibernateGtfsRelationalDaoImpl.java

示例14: getCalendarForId

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Override
public ServiceCalendar getCalendarForId(int id) {
  return (ServiceCalendar) _ops.get(ServiceCalendar.class, id);
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:5,代碼來源:HibernateGtfsRelationalDaoImpl.java

示例15: compare

import org.onebusaway.gtfs.model.ServiceCalendar; //導入依賴的package包/類
@Override
public int compare(ServiceCalendar o1, ServiceCalendar o2) {
  AgencyAndId id1 = o1.getServiceId();
  AgencyAndId id2 = o2.getServiceId();
  return id1.compareTo(id2);
}
 
開發者ID:gov-ithub,項目名稱:infotranspub-backend,代碼行數:7,代碼來源:ServiceCalendarComparator.java


注:本文中的org.onebusaway.gtfs.model.ServiceCalendar類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。