Package org.optaplanner.examples.pas.domain

Examples of org.optaplanner.examples.pas.domain.Department


            for (int i = 0; i < departmentListSize; i++) {
                String line = bufferedReader.readLine();
                String[] lineTokens = splitByPipelineAndTrim(line, 2);

                String[] departmentTokens = splitBySpace(lineTokens[0], 4);
                Department department = new Department();
                department.setId(Long.parseLong(departmentTokens[0]));
                department.setName(departmentTokens[1]);
                department.setRoomList(new ArrayList<Room>());
                int minimumAge = Integer.parseInt(departmentTokens[2]);
                if (minimumAge != 0) {
                    department.setMinimumAge(Integer.valueOf(minimumAge));
                }
                int maximumAge = Integer.parseInt(departmentTokens[3]);
                if (maximumAge != 0) {
                    department.setMaximumAge(Integer.valueOf(maximumAge));
                }
                departmentList.add(department);
                idToDepartmentMap.put(department.getId(), department);

                String[] departmentSpecialismTokens = splitBySpace(lineTokens[1]);
                if (departmentSpecialismTokens.length % 2 != 0) {
                    throw new IllegalArgumentException("Read line (" + line
                            + ") is expected to contain even number of tokens (" + departmentSpecialismTokens.length
View Full Code Here


                String[] roomTokens = splitBySpace(lineTokens[0], 2);
                Room room = new Room();
                room.setId(Long.parseLong(roomTokens[0]));
                room.setName(roomTokens[1]);
                room.setCapacity(Integer.parseInt(lineTokens[1]));
                Department department = idToDepartmentMap.get(
                        Long.parseLong(lineTokens[2]));
                room.setDepartment(department);
                room.setGenderLimitation(GenderLimitation.valueOfCode(lineTokens[3]));
                room.setBedList(new ArrayList<Bed>());
                roomList.add(room);
                idToRoomMap.put(room.getId(), room);
                department.getRoomList().add(room);

                String[] roomSpecialismTokens = splitBySpace(lineTokens[4]);
                if (roomSpecialismTokens.length % 2 != 0) {
                    throw new IllegalArgumentException("Read line (" + line
                            + ") is expected to contain even number of tokens (" + roomSpecialismTokens.length
View Full Code Here

            return -1;
        } else if (b == null) {
            return 1;
        }
        Room aRoom = a.getRoom();
        Department aDepartment = aRoom.getDepartment();
        Room bRoom = b.getRoom();
        Department bDepartment = bRoom.getDepartment();
        return new CompareToBuilder()
                // null minimumAge is stronger
                .append(aDepartment.getMinimumAge() == null, bDepartment.getMinimumAge() == null)
                // null maximumAge is stronger
                .append(aDepartment.getMaximumAge() == null, bDepartment.getMaximumAge() == null)
                // Descending, low minimumAge is stronger
                .append(bDepartment.getMinimumAge(), aDepartment.getMinimumAge())
                // High maximumAge is stronger
                .append(aDepartment.getMaximumAge(), bDepartment.getMaximumAge())
                .append(aRoom.getRoomEquipmentList().size(), bRoom.getRoomEquipmentList().size())
                .append(aRoom.getRoomSpecialismList().size(), bRoom.getRoomSpecialismList().size())
                .append(bRoom.getCapacity(), aRoom.getCapacity()) // Descending (smaller rooms are stronger)
                .append(a.getId(), b.getId())
                .toComparison();
View Full Code Here

TOP

Related Classes of org.optaplanner.examples.pas.domain.Department

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.