public static Service createService(PatternTimetable timetable){
  Calendar calendar=new Calendar();
  calendar.monday=timetable.monday ? 1 : 0;
  calendar.tuesday=timetable.tuesday ? 1 : 0;
  calendar.wednesday=timetable.wednesday ? 1 : 0;
  calendar.thursday=timetable.thursday ? 1 : 0;
  calendar.friday=timetable.friday ? 1 : 0;
  calendar.saturday=timetable.saturday ? 1 : 0;
  calendar.sunday=timetable.sunday ? 1 : 0;
  StringBuilder nameBuilder=new StringBuilder("MOD-");
  nameBuilder.append(timetable.monday ? 'M' : 'x');
  nameBuilder.append(timetable.monday ? 'T' : 'x');
  nameBuilder.append(timetable.monday ? 'W' : 'x');
  nameBuilder.append(timetable.monday ? 'T' : 'x');
  nameBuilder.append(timetable.monday ? 'F' : 'x');
  nameBuilder.append(timetable.monday ? 'S' : 'x');
  nameBuilder.append(timetable.monday ? 'S' : 'x');
  Service service=new Service(nameBuilder.toString());
  calendar.start_date=18500101;
  calendar.end_date=22000101;
  service.calendar=calendar;
  return service;
}

public static Service createService ( PatternTimetable timetable ) { Calendar calendar = new Calendar ( ) ; calendar . monday = timetable . monday ? 1 : 0 ; calendar . tuesday = timetable . tuesday ? 1 : 0 ; calendar . wednesday = timetable . wednesday ? 1 : 0 ; calendar . thursday = timetable . thursday ? 1 : 0 ; calendar . friday = timetable . friday ? 1 : 0 ; calendar . saturday = timetable . saturday ? 1 : 0 ; calendar . sunday = timetable . sunday ? 1 : 0 ; StringBuilder nameBuilder = new StringBuilder ( "MOD-" ) ; nameBuilder . append ( timetable . monday ? 'M' : 'x' ) ; nameBuilder . append ( timetable . monday ? 'T' : 'x' ) ; nameBuilder . append ( timetable . monday ? 'W' : 'x' ) ; nameBuilder . append ( timetable . monday ? 'T' : 'x' ) ; nameBuilder . append ( timetable . monday ? 'F' : 'x' ) ; nameBuilder . append ( timetable . monday ? 'S' : 'x' ) ; nameBuilder . append ( timetable . monday ? 'S' : 'x' ) ; Service service = new Service ( nameBuilder . toString ( ) ) ; calendar . start_date = 18500101 ; calendar . end_date = 22000101 ; service . calendar = calendar ; return service ; }
creates a gtfs - lib service object based on the information in the given patterntimetable , which is usually part of a modification deserialized from json .
