if(def.getCalendar().getMarketHoursCount() == 0) {
return Schedule.NULL;
}
final Calendar c = def.getCalendar();
final TimeInterval[] ti = new TimeInterval[c.getMarketHoursCount()];
for(int i = 0; i < c.getMarketHoursCount(); i++) {
final Interval inter = c.getMarketHours(i);
ti[i] = factory.newTimeInterval(inter.getTimeStart(),
inter.getTimeFinish());
}
factory.newSchedule(ti);