当前位置: 首页>>代码示例>>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;未经允许,请勿转载。