class TradingWeekImpl extends JodaWorkingWeek implements TradingWeek {

    @Override
	public TradingSession getTradingSessionOnOrAfter(DateTime date) {
        if(sessions.size() == 0) {
            throw new IllegalStateException("Trading week has no sessions configured!");
        }
        while(!isWorkingDay(date.toLocalDate())) {
            date = date.plusDays(1);
        }
        int otherDay = date.getDayOfWeek();
        LocalTime lt = date.toLocalTime();
        int len = sessions.size();
        for(int i = 0;i < len;i++) {
            TradingSession ts = sessions.get(i);
            if(ts.contains(date)) {
                return ts;
            }else if(ts.day() == otherDay){
               if(ts.start().isAfter(lt)) {
                   return ts;
               }else if(ts.end().isBefore(lt)) {
                   return sessions.get(i == len - 1 ? 0 : i + 1);
               }
            }
        }
        return null;
    }

    private  TradingWeekImpl(byte tradingDays);

}