/** * Copy method for WatchTimeExceptionData. * * @param data the data to be copied from * @return the new WatchTimeExceptionData */ private WatchTimeExceptionData addWatchTimeExceptionData(WatchTimeExceptionData data) { if (data != null) { int[] daysAsInt = data.getDaysOfWeek(); List<TimeSpan> exceptionTimes = new LinkedList<TimeSpan>(); for (TimeSpan s : data.getTimesOfDay()) { Time newFromTime = new Time(s.getFrom().getHour(), s.getFrom().getMinute()); Time newToTime = new Time(s.getTo().getHour(), s.getTo().getMinute()); exceptionTimes.add(new TimeSpan(newFromTime, newToTime)); } return new WatchTimeExceptionData(daysAsInt, exceptionTimes); } else { return null; } }