/** {@inheritDoc} */ @Override public void parse(int year, Set<Holiday> holidays, final Holidays config) { for (RelativeToFixed rf : config.getRelativeToFixed()) { if (!isValid(rf, year)) { continue; } LocalDate fixed = calendarUtil.create(year, rf.getDate()); if (rf.getWeekday() != null) { // if weekday is set -> move to weekday DayOfWeek day = xmlUtil.getWeekday(rf.getWeekday()); int direction = (rf.getWhen() == When.BEFORE ? -1 : 1); // don't test start day fixed = fixed.plusDays(direction); while (fixed.getDayOfWeek() != day){ fixed = fixed.plusDays(direction); } } else if (rf.getDays() != null) { // if number of days set -> move number of days fixed = fixed.plusDays(rf.getWhen() == When.BEFORE ? -rf.getDays() : rf.getDays()); } HolidayType type = xmlUtil.getType(rf.getLocalizedType()); holidays.add(new Holiday(fixed, rf.getDescriptionPropertiesKey(), type)); } }