public DateConstraint createStandardSchedule(String[] description) { DateConstraint standardSchedule = new DateConstraint(); Team noTeam = null; ArrayList<DateConstraint> components = new ArrayList<DateConstraint>(); for (String request : description) { request = request.trim().toLowerCase(); for (int i = 1; i < LONG_DAYS.length; i++) { String longDay = LONG_DAYS[i]; DateConstraint nextComponent = null; if (request.contains(longDay) && request.contains(":")) { // special constraint: [day] before/after [time] // restrict if both on this day AND at this time-- so take the intersection DateConstraint day = parseDateConstraints(longDay, noTeam, new DateConstraint()); DateConstraint time = parseDateConstraints(cleanRequest(request, longDay), noTeam, new DateConstraint()); nextComponent = DateConstraint.getIntersection(day, time); components.add(nextComponent); } } } for (int i = 0; i < components.size(); i += 2) { // this means the description NEEDS to be paired-- the two constraints describing a day need // to be adjacent DateConstraint c1 = components.get(i); DateConstraint c2 = components.get(i + 1); DateConstraint c = DateConstraint.getIntersection(c1, c2); // and then OR all the components together standardSchedule = new DateConstraint(standardSchedule, c); } // wipe holidays for (LocalDate holiday : holidays) { int holidayIndex = standardSchedule.findDate(holiday); standardSchedule.blockDate(holidayIndex); } return standardSchedule; }