Package org.drools.planner.examples.nurserostering.domain

Examples of org.drools.planner.examples.nurserostering.domain.NurseRosterInfo


            nurseRoster.setShiftDateList(shiftDateList);
        }

        private void generateNurseRosterInfo(NurseRoster nurseRoster) {
            List<ShiftDate> shiftDateList = nurseRoster.getShiftDateList();
            NurseRosterInfo nurseRosterInfo = new NurseRosterInfo();
            nurseRosterInfo.setFirstShiftDate(shiftDateList.get(0));
            nurseRosterInfo.setLastShiftDate(shiftDateList.get(shiftDateList.size() - 1));
            nurseRosterInfo.setPlanningWindowStart(shiftDateList.get(0));
            nurseRoster.setNurseRosterInfo(nurseRosterInfo);
        }
View Full Code Here


            return;
        }
        solutionBusiness.doProblemFactChange(new ProblemFactChange() {
            public void doChange(ScoreDirector scoreDirector) {
                NurseRoster nurseRoster = (NurseRoster) scoreDirector.getWorkingSolution();
                NurseRosterInfo nurseRosterInfo = nurseRoster.getNurseRosterInfo();
                List<ShiftDate> shiftDateList = nurseRoster.getShiftDateList();
                ShiftDate planningWindowStart = nurseRosterInfo.getPlanningWindowStart();
                int windowStartIndex = shiftDateList.indexOf(planningWindowStart);
                if (windowStartIndex < 0) {
                    throw new IllegalStateException("The planningWindowStart ("
                            + planningWindowStart + ") must be in the shiftDateList ("
                            + shiftDateList +").");
                }
                ShiftDate oldLastShiftDate = shiftDateList.get(shiftDateList.size() - 1);
                ShiftDate newShiftDate = new ShiftDate();
                newShiftDate.setId(oldLastShiftDate.getId() + 1L);
                newShiftDate.setDayIndex(oldLastShiftDate.getDayIndex() + 1);
                newShiftDate.setDateString(oldLastShiftDate.determineNextDateString());
                newShiftDate.setDayOfWeek(oldLastShiftDate.getDayOfWeek().determineNextDayOfWeek());
                List<Shift> refShiftList = planningWindowStart.getShiftList();
                List<Shift> newShiftList = new ArrayList<Shift>(refShiftList.size());
                newShiftDate.setShiftList(newShiftList);
                nurseRoster.getShiftDateList().add(newShiftDate);
                scoreDirector.afterProblemFactAdded(newShiftDate);
                Shift oldLastShift = nurseRoster.getShiftList().get(nurseRoster.getShiftList().size() - 1);
                long shiftId = oldLastShift.getId() + 1L;
                int shiftIndex = oldLastShift.getIndex() + 1;
                long shiftAssignmentId = nurseRoster.getShiftAssignmentList().get(
                        nurseRoster.getShiftAssignmentList().size() - 1).getId() + 1L;
                for (Shift refShift : refShiftList) {
                    Shift newShift = new Shift();
                    newShift.setId(shiftId);
                    shiftId++;
                    newShift.setShiftDate(newShiftDate);
                    newShift.setShiftType(refShift.getShiftType());
                    newShift.setIndex(shiftIndex);
                    shiftIndex++;
                    newShift.setRequiredEmployeeSize(refShift.getRequiredEmployeeSize());
                    newShiftList.add(newShift);
                    nurseRoster.getShiftList().add(newShift);
                    scoreDirector.afterProblemFactAdded(newShift);
                    for (int indexInShift = 0; indexInShift < newShift.getRequiredEmployeeSize(); indexInShift++) {
                        ShiftAssignment newShiftAssignment = new ShiftAssignment();
                        newShiftAssignment.setId(shiftAssignmentId);
                        shiftAssignmentId++;
                        newShiftAssignment.setShift(newShift);
                        newShiftAssignment.setIndexInShift(indexInShift);
                        nurseRoster.getShiftAssignmentList().add(newShiftAssignment);
                        scoreDirector.afterEntityAdded(newShiftAssignment);
                    }
                }
                windowStartIndex++;
                ShiftDate newPlanningWindowStart = shiftDateList.get(windowStartIndex);
                nurseRosterInfo.setPlanningWindowStart(newPlanningWindowStart);
                nurseRosterInfo.setLastShiftDate(newShiftDate);
                scoreDirector.afterProblemFactChanged(nurseRosterInfo);
            }
        });
        resetPanel(solutionBusiness.getSolution());
        validate();
View Full Code Here

TOP

Related Classes of org.drools.planner.examples.nurserostering.domain.NurseRosterInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.