Création d'une interface pour la visualisation des horaires initales et des horaires avec absences
Ajout de l'héritage entre les classes AbsenceScheduleArray et ScheduleArray. TODO : Toujours pas capable de générer des horaires différentes.
This commit is contained in:
parent
01bcfd4e6e
commit
54eca9baa6
9 changed files with 590 additions and 222 deletions
|
@ -1,41 +1,32 @@
|
|||
package AbsenceSchedules;
|
||||
|
||||
import InitialSchedules.InitialSchedulesArray;
|
||||
import InitialSchedules.ModelInitialSchedules;
|
||||
import ScheduleUtil.SchedulesArray;
|
||||
import jdistlib.rng.RandomEngine;
|
||||
import org.chocosolver.solver.Solution;
|
||||
|
||||
public class AbsenceSchedulesArray {
|
||||
private int[][] PartTimeSchedules;
|
||||
private int[][] FullTimeSchedules;
|
||||
public class AbsenceSchedulesArray extends SchedulesArray{
|
||||
|
||||
public AbsenceSchedulesArray(InitialSchedulesArray I, RandomEngine r) {
|
||||
|
||||
int mpte = I.getMaxPartTimeEmployee();
|
||||
int mfte = I.getMaxFullTimeEmployee();
|
||||
int[][] pts = I.getPartTimeSchedules();
|
||||
int[][] fts = I.getFullTimeSchedules();
|
||||
int wps = I.getWorkPeriodsPerSchedule();
|
||||
PartTimeSchedules = new int[mpte][wps];
|
||||
FullTimeSchedules = new int[mfte][wps];
|
||||
|
||||
for (int i = 0; i < I.getMaxPartTimeEmployee(); i++) {
|
||||
int[] a = new AbsencesVector(wps, r).getAbsencesVector();
|
||||
for (int j = 0; j < wps; j++) {
|
||||
this.PartTimeSchedules[i][j] = pts[i][j] * a[j];
|
||||
public AbsenceSchedulesArray(SchedulesArray myScheduleArray) {
|
||||
super(myScheduleArray);
|
||||
}
|
||||
|
||||
public void generateAbsences(RandomEngine r) {
|
||||
for (int i = 0; i < this.maxPartTimeEmployee; i++) {
|
||||
int[] a = new AbsencesVector(this.workPeriodsPerSchedule, r).getAbsencesVector();
|
||||
for (int j = 0; j < this.workPeriodsPerSchedule; j++) {
|
||||
this.PartTimeSchedules[i][j] = this.PartTimeSchedules[i][j] * a[j];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < I.getMaxFullTimeEmployee(); i++) {
|
||||
int[] a = new AbsencesVector(wps, r).getAbsencesVector();
|
||||
for (int j = 0; j < wps; j++) {
|
||||
this.FullTimeSchedules[i][j] = fts[i][j] * a[j];
|
||||
for (int i = 0; i < this.maxFullTimeEmployee; i++) {
|
||||
int[] a = new AbsencesVector(this.workPeriodsPerSchedule, r).getAbsencesVector();
|
||||
for (int j = 0; j < this.workPeriodsPerSchedule; j++) {
|
||||
this.FullTimeSchedules[i][j] = this.FullTimeSchedules[i][j] * a[j];
|
||||
}
|
||||
}
|
||||
updateEmployeesPerWorkPeriod();
|
||||
updateWorkingPeriodsPerPartTimeEmployees();
|
||||
updateWorkingPeriodsPerFullTimeEmployees();
|
||||
}
|
||||
|
||||
public int[][] getFullTimeSchedules() {
|
||||
return FullTimeSchedules;
|
||||
}
|
||||
|
||||
public int[][] getPartTimeSchedules() {
|
||||
return PartTimeSchedules;
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package InitialSchedules;
|
||||
|
||||
import org.chocosolver.solver.Solution;
|
||||
|
||||
public class InitialSchedulesArray {
|
||||
|
||||
private int[][] PartTimeSchedules;
|
||||
private int[][] FullTimeSchedules;
|
||||
private int maxPartTimeEmployee;
|
||||
private int maxFullTimeEmployee;
|
||||
private int workPeriodsPerSchedule;
|
||||
private ModelInitialSchedules myModelInitialSchedules;
|
||||
|
||||
public InitialSchedulesArray(ModelInitialSchedules m, Solution s) {
|
||||
this.myModelInitialSchedules = m;
|
||||
Solution mySolution = s;
|
||||
this.maxPartTimeEmployee = myModelInitialSchedules.maxPartTimeEmployee;
|
||||
this.maxFullTimeEmployee = myModelInitialSchedules.maxFullTimeEmployee;
|
||||
this.workPeriodsPerSchedule = myModelInitialSchedules.myScheduleParameters.workPeriodsPerSchedule;
|
||||
|
||||
this.PartTimeSchedules = new int[this.maxPartTimeEmployee][this.workPeriodsPerSchedule];
|
||||
this.FullTimeSchedules = new int[this.maxFullTimeEmployee][this.workPeriodsPerSchedule];
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
for (int employee = 0; employee < this.maxPartTimeEmployee; employee++) {
|
||||
this.PartTimeSchedules[employee][workPeriod] = mySolution.getIntVal(myModelInitialSchedules.workPeriodsSchedulesOfPartTimeEmployees[employee][workPeriod]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
for (int employee = 0; employee < this.maxFullTimeEmployee; employee++) {
|
||||
this.FullTimeSchedules[employee][workPeriod] = mySolution.getIntVal(myModelInitialSchedules.workPeriodsSchedulesOfFullTimeEmployees[employee][workPeriod]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxFullTimeEmployee() {
|
||||
return maxFullTimeEmployee;
|
||||
}
|
||||
|
||||
public int getMaxPartTimeEmployee() {
|
||||
return maxPartTimeEmployee;
|
||||
}
|
||||
|
||||
public int getWorkPeriodsPerSchedule() {
|
||||
return workPeriodsPerSchedule;
|
||||
}
|
||||
|
||||
public int[][] getFullTimeSchedules() {
|
||||
return FullTimeSchedules;
|
||||
}
|
||||
|
||||
public int[][] getPartTimeSchedules() {
|
||||
return PartTimeSchedules;
|
||||
}
|
||||
}
|
|
@ -4,10 +4,10 @@ import org.chocosolver.solver.constraints.extension.Tuples;
|
|||
|
||||
public class ParametersInitialSchedules {
|
||||
|
||||
int workPeriodsPerDay;
|
||||
public int workPeriodsPerDay;
|
||||
int shiftWorkPerDay;
|
||||
int daysPerSchedule;
|
||||
int workPeriodsPerSchedule;
|
||||
public int daysPerSchedule;
|
||||
public int workPeriodsPerSchedule;
|
||||
int totalWorkedPeriodsInSchedule;
|
||||
int hoursPerWorkPeriod;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class ParametersInitialSchedules {
|
|||
|
||||
this.requiredWorkforce = new int[this.daysPerSchedule * this.workPeriodsPerDay];
|
||||
this.totalWorkedPeriodsInSchedule = 0;
|
||||
int[] dailyRequiredWorkforce = new int[]{1, 1, 1, 1, 1, 1};
|
||||
int[] dailyRequiredWorkforce = new int[]{2, 2, 4, 4, 3, 3};
|
||||
for (int day = 0; day < this.daysPerSchedule; day++) {
|
||||
for(int shift = 0; shift < this.workPeriodsPerDay; shift++) {
|
||||
this.requiredWorkforce[day * this.workPeriodsPerDay + shift] = dailyRequiredWorkforce[shift];
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
package InitialSchedules;
|
||||
|
||||
// classe statique pour mettre fonction utilitaire
|
||||
public class UtilInitialSchedules {
|
||||
|
||||
private UtilInitialSchedules() {
|
||||
}
|
||||
|
||||
public static void refineInitialSchedules() {
|
||||
// A implementer si on veut rafiner la banque d'horaires initiales
|
||||
}
|
||||
|
||||
public static void printSolutionResults(ModelInitialSchedules myModelInitialSchedules, ParametersInitialSchedules myScheduleParameters) {
|
||||
// Cette fonction sera a ameliorer avec des sous-fonctions, car elle n'est pas tres explicite.
|
||||
System.out.print("Schedule Day ");
|
||||
for (int day = 1; day <= myScheduleParameters.daysPerSchedule; day++) {
|
||||
System.out.print(day);
|
||||
System.out.print(" ");
|
||||
if (day < 10) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.print("|");
|
||||
}
|
||||
System.out.print("Worked Periods");
|
||||
System.out.println("");
|
||||
System.out.println("Part-Time Employees");
|
||||
int partTimeemployeeNo = 1;
|
||||
for (int employee = 0; employee < myModelInitialSchedules.maxPartTimeEmployee; employee++) {
|
||||
if (myModelInitialSchedules.workingPeriodsPerPartTimeEmployees[employee].getValue() >= 0) {
|
||||
System.out.print("Employee ");
|
||||
System.out.print(partTimeemployeeNo);
|
||||
System.out.print(" ");
|
||||
if (partTimeemployeeNo < 10) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
|
||||
if (myModelInitialSchedules.workPeriodsSchedulesOfPartTimeEmployees[employee][workPeriod].getValue() == 1) {
|
||||
System.out.print("1");
|
||||
} else {
|
||||
System.out.print("0");
|
||||
|
||||
}
|
||||
if (workPeriod % myScheduleParameters.workPeriodsPerDay == 5 && workPeriod != 0) {
|
||||
System.out.print("|");
|
||||
}
|
||||
}
|
||||
System.out.print(myModelInitialSchedules.workingPeriodsPerPartTimeEmployees[employee].getValue());
|
||||
System.out.println("");
|
||||
partTimeemployeeNo++;
|
||||
}
|
||||
}
|
||||
int fullTimeemployeeNo = 1;
|
||||
System.out.println("Full-Time Employees");
|
||||
for (int employee = 0; employee < myModelInitialSchedules.maxFullTimeEmployee; employee++) {
|
||||
if (myModelInitialSchedules.workingPeriodsPerFullTimeEmployees[employee].getValue() >= 0) {
|
||||
System.out.print("Employee ");
|
||||
System.out.print(fullTimeemployeeNo);
|
||||
System.out.print(" ");
|
||||
if (fullTimeemployeeNo < 10) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
|
||||
if (myModelInitialSchedules.workPeriodsSchedulesOfFullTimeEmployees[employee][workPeriod].getValue() == 1) {
|
||||
System.out.print("1");
|
||||
} else {
|
||||
System.out.print("0");
|
||||
|
||||
}
|
||||
if (workPeriod % 6 == 5 && workPeriod != 0) {
|
||||
System.out.print("|");
|
||||
}
|
||||
}
|
||||
System.out.print(myModelInitialSchedules.workingPeriodsPerFullTimeEmployees[employee].getValue());
|
||||
System.out.println("");
|
||||
fullTimeemployeeNo++;
|
||||
}
|
||||
}
|
||||
System.out.print("Working Employees ");
|
||||
for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
|
||||
System.out.print(myModelInitialSchedules.employeesPerWorkPeriods[workPeriod].getValue());
|
||||
if (workPeriod % 6 == 5 && workPeriod != 0) {
|
||||
System.out.print("|");
|
||||
}
|
||||
}
|
||||
System.out.println("");
|
||||
System.out.print("Required Workforce ");
|
||||
for (int workPeriod = 0; workPeriod < myScheduleParameters.workPeriodsPerSchedule; workPeriod++) {
|
||||
System.out.print(myScheduleParameters.requiredWorkforce[workPeriod]);
|
||||
if (workPeriod % 6 == 5 && workPeriod != 0) {
|
||||
System.out.print("|");
|
||||
}
|
||||
}
|
||||
System.out.println("");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,31 +1,35 @@
|
|||
import AbsenceSchedules.AbsenceSchedulesArray;
|
||||
import InitialSchedules.InitialSchedulesArray;
|
||||
//import AbsenceSchedules.AbsenceSchedulesArray;
|
||||
import jdistlib.rng.MersenneTwister;
|
||||
import jdistlib.rng.RandomEngine;
|
||||
import org.chocosolver.solver.Model;
|
||||
import org.chocosolver.solver.Solution;
|
||||
import org.chocosolver.solver.Solver;
|
||||
import org.chocosolver.solver.exception.ContradictionException;
|
||||
import ScheduleUtil.SchedulesArray;
|
||||
import AbsenceSchedules.AbsenceSchedulesArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.lang.*;
|
||||
|
||||
|
||||
|
||||
public class MainClass {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Le main ne devrait contenir que les 5 fonctions correspondantes aux etapes du pipeline
|
||||
List<InitialSchedules.InitialSchedulesArray> InitialSchedulesArrayList = generateInitialSchedule();
|
||||
List<SchedulesArray> initialSchedulesArrayList = generateInitialSchedule();
|
||||
|
||||
GenerateAbsencesSchedule(InitialSchedulesArrayList);
|
||||
GenerateAbsencesSchedule(initialSchedulesArrayList);
|
||||
// Creer les simulation avec une autre classe. Faire un nouveau package de fonctions.
|
||||
// Algo de recouvrement d'absences. Faire un nouveau package de fonctions.
|
||||
// Trouver meilleure solution et l'afficher.
|
||||
}
|
||||
|
||||
private static List<InitialSchedules.InitialSchedulesArray> generateInitialSchedule() {
|
||||
private static List<SchedulesArray> generateInitialSchedule() {
|
||||
|
||||
List<InitialSchedules.InitialSchedulesArray> InitialSchedulesArrayList = new ArrayList<>();
|
||||
List<SchedulesArray> initialSchedulesArrayList = new ArrayList<>();
|
||||
|
||||
InitialSchedules.ParametersInitialSchedules myScheduleParameters
|
||||
= new InitialSchedules.ParametersInitialSchedules();
|
||||
|
@ -44,50 +48,43 @@ public class MainClass {
|
|||
System.err.println("Caught Exception: " + e.getMessage());
|
||||
}
|
||||
|
||||
//solverInitialSchedules.showDashboard();
|
||||
solverInitialSchedules.showDashboard();
|
||||
/*solverInitialSchedules.setSearch(Search.domOverWDegSearch(myModelInitialSchedules.allWorkPeriods));*/
|
||||
//solverInitialSchedules.setRestartOnSolutions(); /*Sans restart, toutes les horaires sont identiques*/
|
||||
solverInitialSchedules.limitSolution(1);
|
||||
solverInitialSchedules.limitTime(10000);
|
||||
// solverInitialSchedules.setRestartOnSolutions(); /*Sans restart, toutes les horaires sont identiques*/
|
||||
solverInitialSchedules.limitSolution(2);
|
||||
//solverInitialSchedules.limitTime(10000);
|
||||
List<Solution> myInitialSchedulesSolutions;
|
||||
/*myInitialSchedulesSolutions = solverInitialSchedules.findAllOptimalSolutions
|
||||
(myModelInitialSchedules.TotalEmployeesSalary, Model.MINIMIZE);*/
|
||||
// myInitialSchedulesSolutions = solverInitialSchedules.findAllOptimalSolutions
|
||||
// (myModelInitialSchedules.TotalEmployeesSalary, Model.MINIMIZE);
|
||||
|
||||
myInitialSchedulesSolutions = solverInitialSchedules.findAllSolutions
|
||||
();
|
||||
|
||||
// fonction pour reduire le nombre d'horaire dans la banque d'horaire.
|
||||
// InitialSchedules.UtilInitialSchedules.refineInitialSchedules(bestInitialSchedules);
|
||||
// On pourrait creer un petit interface pour afficher les horaires optimales et les statistiques.
|
||||
InitialSchedules.UtilInitialSchedules.printSolutionResults(myModelInitialSchedules, myScheduleParameters);
|
||||
myInitialSchedulesSolutions = solverInitialSchedules.findAllSolutions ();
|
||||
solverInitialSchedules.printStatistics();
|
||||
|
||||
// Création de l'objet banque d'horaire, qui est une liste d'objets de type InitialSchedulesArray, qui contiennent chacun deux tableaux.
|
||||
|
||||
|
||||
for (Solution CurrentSolution : myInitialSchedulesSolutions) {
|
||||
InitialSchedulesArray isa = new InitialSchedules.InitialSchedulesArray(myModelInitialSchedules, CurrentSolution);
|
||||
InitialSchedulesArrayList.add(isa);
|
||||
SchedulesArray isa = new SchedulesArray(myModelInitialSchedules, CurrentSolution);
|
||||
initialSchedulesArrayList.add(isa);
|
||||
}
|
||||
|
||||
// Pour afficher les horaires initiales
|
||||
SchedulesWindows.ShowSchedulesFrame intialSchedulesViewer = new SchedulesWindows.ShowSchedulesFrame(initialSchedulesArrayList, "Initial Schedules");
|
||||
|
||||
// Imprimer la liste de matrices
|
||||
/*for (InitialSchedulesArray isa: InitialSchedulesArrayList) {
|
||||
System.out.println(Arrays.deepToString(isa.InitialPartTimeSchedules));
|
||||
}
|
||||
for (InitialSchedulesArray isa: InitialSchedulesArrayList) {
|
||||
System.out.println(Arrays.deepToString(isa.InitialFullTimeSchedules));
|
||||
}*/
|
||||
|
||||
return InitialSchedulesArrayList;
|
||||
return initialSchedulesArrayList;
|
||||
|
||||
}
|
||||
|
||||
private static void GenerateAbsencesSchedule(List<InitialSchedules.InitialSchedulesArray> InitialSchedulesArrayList) {
|
||||
private static void GenerateAbsencesSchedule(List<SchedulesArray> initialSchedulesArrayList) {
|
||||
|
||||
RandomEngine r = new MersenneTwister(123456789);
|
||||
for (InitialSchedulesArray Schedule : InitialSchedulesArrayList) {
|
||||
AbsenceSchedulesArray a = new AbsenceSchedulesArray(Schedule, r);
|
||||
//System.out.println(Arrays.deepToString(a.getPartTimeSchedules()));
|
||||
//System.out.println(Arrays.deepToString(a.getFullTimeSchedules()));
|
||||
List<SchedulesArray> absenceSchedulesArrayList = new ArrayList<>();
|
||||
for (SchedulesArray initialSchedule : initialSchedulesArrayList) {
|
||||
|
||||
// SchedulesArray copyInitialSchedule = initialSchedule.clone();
|
||||
AbsenceSchedulesArray absenceSchedule = new AbsenceSchedulesArray(initialSchedule);
|
||||
absenceSchedule.generateAbsences(r);
|
||||
absenceSchedulesArrayList.add(absenceSchedule);
|
||||
}
|
||||
// Pour afficher les horaires avec absence
|
||||
SchedulesWindows.ShowSchedulesFrame absenceSchedulesViewer = new SchedulesWindows.ShowSchedulesFrame(absenceSchedulesArrayList, "Absence Schedules");
|
||||
}
|
||||
}
|
||||
|
|
86
Travail_de_session/ScheduleUtil/PrintSchedules.java
Normal file
86
Travail_de_session/ScheduleUtil/PrintSchedules.java
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ScheduleUtil;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author frabe
|
||||
*/
|
||||
|
||||
// classe statique pour mettre fonction utilitaire
|
||||
public class PrintSchedules {
|
||||
|
||||
public static String getFormattedSchedule(SchedulesArray schedule) {
|
||||
// Cette fonction sera a ameliorer avec des sous-fonctions, car elle n'est pas tres explicite.
|
||||
StringBuilder sbuf = new StringBuilder();
|
||||
sbuf.append(String.format("%-31s", "Schedule Day"));
|
||||
for (int day = 1; day <= schedule.getDaysPerSchedule(); day++) {
|
||||
sbuf.append(String.format("%02d" + "%18s" + "%s", day, "" , "|"));
|
||||
}
|
||||
sbuf.append(" Worked Periods\n");
|
||||
|
||||
sbuf.append("Part-Time Employees\n");
|
||||
for (int employee = 0; employee < schedule.getMaxPartTimeEmployee(); employee++) {
|
||||
sbuf.append(String.format("%s" + "%02d" + "%-20s","Employee ", employee, " "));
|
||||
|
||||
for (int workPeriod = 0; workPeriod < schedule.getWorkPeriodsPerSchedule(); workPeriod++) {
|
||||
if (schedule.isPartTimeEmployeeWorking(employee,workPeriod)) {
|
||||
sbuf.append(String.format("%2d", 1));
|
||||
} else {
|
||||
sbuf.append(String.format("%2d", 0));
|
||||
}
|
||||
if (workPeriod % schedule.getWorkPeriodPerDay()== 5 && workPeriod != 0) {
|
||||
sbuf.append(String.format("%2s" + "%-2s", "" , "|"));
|
||||
}
|
||||
}
|
||||
|
||||
sbuf.append(String.format("%02d" + "%s", schedule.getWorkingPeriodsPerPartTimeEmployees(employee), "\n"));
|
||||
}
|
||||
|
||||
sbuf.append("Full-Time Employees\n");
|
||||
for (int employee = 0; employee < schedule.getMaxFullTimeEmployee(); employee++) {
|
||||
sbuf.append(String.format("%-5s" + "%02d" + "%-20s","Employee ", employee, " "));
|
||||
|
||||
for (int workPeriod = 0; workPeriod < schedule.getWorkPeriodsPerSchedule(); workPeriod++) {
|
||||
if (schedule.isFullTimeEmployeeWorking(employee,workPeriod)) {
|
||||
sbuf.append(String.format("%2d", 1));
|
||||
} else {
|
||||
sbuf.append(String.format("%2d", 0));
|
||||
}
|
||||
if (workPeriod % schedule.getWorkPeriodPerDay()== 5 && workPeriod != 0) {
|
||||
sbuf.append(String.format("%2s" + "%-2s", "" , "|"));
|
||||
}
|
||||
}
|
||||
sbuf.append(String.format("%02d" + "%s", schedule.getWorkingPeriodsPerFullTimeEmployees(employee), "\n"));
|
||||
|
||||
}
|
||||
|
||||
sbuf.append(String.format("%-24s", "Working Employees "));
|
||||
for (int workPeriod = 0; workPeriod < schedule.getWorkPeriodsPerSchedule(); workPeriod++) {
|
||||
sbuf.append(String.format("%2d", schedule.getEmployeesPerWorkPeriod(workPeriod)));
|
||||
if (workPeriod % schedule.getWorkPeriodPerDay() == 5 && workPeriod != 0) {
|
||||
sbuf.append(String.format("%2s" + "%-2s", "" , "|"));
|
||||
}
|
||||
}
|
||||
sbuf.append("\n");
|
||||
|
||||
sbuf.append(String.format("%-25s", "Required Workforce "));
|
||||
for (int workPeriod = 0; workPeriod < schedule.getWorkPeriodsPerSchedule(); workPeriod++) {
|
||||
sbuf.append(String.format("%2d", schedule.getRequiredWorkForce(workPeriod)));
|
||||
if (workPeriod % schedule.getWorkPeriodPerDay() == 5 && workPeriod != 0) {
|
||||
sbuf.append(String.format("%2s" + "%-2s", "" , "|"));
|
||||
}
|
||||
}
|
||||
sbuf.append("\n");
|
||||
|
||||
return sbuf.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
187
Travail_de_session/ScheduleUtil/SchedulesArray.java
Normal file
187
Travail_de_session/ScheduleUtil/SchedulesArray.java
Normal file
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ScheduleUtil;
|
||||
|
||||
import InitialSchedules.*;
|
||||
import jdistlib.rng.RandomEngine;
|
||||
import org.chocosolver.solver.Solution;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author frabe
|
||||
*/
|
||||
public class SchedulesArray {
|
||||
|
||||
protected int[][] PartTimeSchedules;
|
||||
protected int[][] FullTimeSchedules;
|
||||
protected int[] employeesPerWorkPeriod;
|
||||
protected int[] workingPeriodsPerPartTimeEmployees;
|
||||
protected int[] workingPeriodsPerFullTimeEmployees;
|
||||
protected int maxPartTimeEmployee;
|
||||
protected int maxFullTimeEmployee;
|
||||
protected int workPeriodsPerSchedule;
|
||||
protected int workPeriodsPerDay;
|
||||
protected int daysPerSchedule;
|
||||
protected ModelInitialSchedules myModelInitialSchedules;
|
||||
|
||||
protected SchedulesArray() {
|
||||
|
||||
}
|
||||
|
||||
// Constructeur Copie
|
||||
protected SchedulesArray(SchedulesArray myScheduleArray) {
|
||||
|
||||
this.maxPartTimeEmployee = myScheduleArray.maxPartTimeEmployee;
|
||||
this.maxFullTimeEmployee = myScheduleArray.maxFullTimeEmployee;
|
||||
this.workPeriodsPerSchedule = myScheduleArray.workPeriodsPerSchedule;
|
||||
this.workPeriodsPerDay = myScheduleArray.workPeriodsPerDay;
|
||||
this.daysPerSchedule = myScheduleArray.daysPerSchedule;
|
||||
this.myModelInitialSchedules = myScheduleArray.myModelInitialSchedules;
|
||||
|
||||
this.PartTimeSchedules = new int[this.maxPartTimeEmployee][this.workPeriodsPerSchedule];
|
||||
this.FullTimeSchedules = new int[this.maxFullTimeEmployee][this.workPeriodsPerSchedule];
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
for (int employee = 0; employee < this.maxPartTimeEmployee; employee++) {
|
||||
this.PartTimeSchedules[employee][workPeriod] = myScheduleArray.PartTimeSchedules[employee][workPeriod];
|
||||
}
|
||||
}
|
||||
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
for (int employee = 0; employee < this.maxFullTimeEmployee; employee++) {
|
||||
this.FullTimeSchedules[employee][workPeriod] = myScheduleArray.FullTimeSchedules[employee][workPeriod];
|
||||
}
|
||||
}
|
||||
|
||||
this.employeesPerWorkPeriod = new int[this.workPeriodsPerSchedule];
|
||||
this.workingPeriodsPerPartTimeEmployees = new int[this.maxPartTimeEmployee];
|
||||
this.workingPeriodsPerFullTimeEmployees = new int[this.maxFullTimeEmployee];
|
||||
|
||||
updateEmployeesPerWorkPeriod();
|
||||
updateWorkingPeriodsPerPartTimeEmployees();
|
||||
updateWorkingPeriodsPerFullTimeEmployees();
|
||||
|
||||
}
|
||||
|
||||
public SchedulesArray(ModelInitialSchedules m, Solution s) {
|
||||
this.myModelInitialSchedules = m;
|
||||
Solution mySolution = s;
|
||||
this.maxPartTimeEmployee = myModelInitialSchedules.maxPartTimeEmployee;
|
||||
this.maxFullTimeEmployee = myModelInitialSchedules.maxFullTimeEmployee;
|
||||
this.workPeriodsPerSchedule = myModelInitialSchedules.myScheduleParameters.workPeriodsPerSchedule;
|
||||
this.workPeriodsPerDay = myModelInitialSchedules.myScheduleParameters.workPeriodsPerDay;
|
||||
this.daysPerSchedule = myModelInitialSchedules.myScheduleParameters.daysPerSchedule;
|
||||
|
||||
this.PartTimeSchedules = new int[this.maxPartTimeEmployee][this.workPeriodsPerSchedule];
|
||||
this.FullTimeSchedules = new int[this.maxFullTimeEmployee][this.workPeriodsPerSchedule];
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
for (int employee = 0; employee < this.maxPartTimeEmployee; employee++) {
|
||||
this.PartTimeSchedules[employee][workPeriod] = mySolution.getIntVal(myModelInitialSchedules.workPeriodsSchedulesOfPartTimeEmployees[employee][workPeriod]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
for (int employee = 0; employee < this.maxFullTimeEmployee; employee++) {
|
||||
this.FullTimeSchedules[employee][workPeriod] = mySolution.getIntVal(myModelInitialSchedules.workPeriodsSchedulesOfFullTimeEmployees[employee][workPeriod]);
|
||||
}
|
||||
}
|
||||
|
||||
this.employeesPerWorkPeriod = new int[this.workPeriodsPerSchedule];
|
||||
this.workingPeriodsPerPartTimeEmployees = new int[this.maxPartTimeEmployee];
|
||||
this.workingPeriodsPerFullTimeEmployees = new int[this.maxFullTimeEmployee];
|
||||
|
||||
updateEmployeesPerWorkPeriod();
|
||||
updateWorkingPeriodsPerPartTimeEmployees();
|
||||
updateWorkingPeriodsPerFullTimeEmployees();
|
||||
|
||||
}
|
||||
|
||||
protected void updateEmployeesPerWorkPeriod() {
|
||||
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
this.employeesPerWorkPeriod[workPeriod] = 0;
|
||||
for (int employee = 0; employee < this.maxPartTimeEmployee; employee++) {
|
||||
this.employeesPerWorkPeriod[workPeriod] += this.PartTimeSchedules[employee][workPeriod];
|
||||
}
|
||||
for (int employee = 0; employee < this.maxFullTimeEmployee; employee++) {
|
||||
this.employeesPerWorkPeriod[workPeriod] += this.FullTimeSchedules[employee][workPeriod];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateWorkingPeriodsPerPartTimeEmployees() {
|
||||
|
||||
for (int employee = 0; employee < this.maxPartTimeEmployee; employee++) {
|
||||
this.workingPeriodsPerPartTimeEmployees[employee] = 0;
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
this.workingPeriodsPerPartTimeEmployees[employee] += this.PartTimeSchedules[employee][workPeriod];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateWorkingPeriodsPerFullTimeEmployees() {
|
||||
|
||||
for (int employee = 0; employee < this.maxFullTimeEmployee; employee++) {
|
||||
this.workingPeriodsPerFullTimeEmployees[employee] = 0;
|
||||
for (int workPeriod = 0; workPeriod < this.workPeriodsPerSchedule; workPeriod++) {
|
||||
this.workingPeriodsPerFullTimeEmployees[employee] += this.FullTimeSchedules[employee][workPeriod];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxFullTimeEmployee() {
|
||||
return maxFullTimeEmployee;
|
||||
}
|
||||
|
||||
public int getMaxPartTimeEmployee() {
|
||||
return maxPartTimeEmployee;
|
||||
}
|
||||
|
||||
public int getWorkPeriodsPerSchedule() {
|
||||
return workPeriodsPerSchedule;
|
||||
}
|
||||
|
||||
public int getDaysPerSchedule() {
|
||||
return daysPerSchedule;
|
||||
}
|
||||
|
||||
public int getWorkPeriodPerDay() {
|
||||
return workPeriodsPerDay;
|
||||
}
|
||||
|
||||
public int[][] getFullTimeSchedules() {
|
||||
return FullTimeSchedules;
|
||||
}
|
||||
|
||||
public int[][] getPartTimeSchedules() {
|
||||
return PartTimeSchedules;
|
||||
}
|
||||
|
||||
public boolean isPartTimeEmployeeWorking(int employee, int workPeriod) {
|
||||
return PartTimeSchedules[employee][workPeriod] == 1;
|
||||
}
|
||||
|
||||
public boolean isFullTimeEmployeeWorking(int employee, int workPeriod) {
|
||||
return FullTimeSchedules[employee][workPeriod] == 1;
|
||||
}
|
||||
|
||||
public int getRequiredWorkForce(int workPeriod) {
|
||||
return myModelInitialSchedules.myScheduleParameters.requiredWorkforce[workPeriod];
|
||||
}
|
||||
|
||||
public int getEmployeesPerWorkPeriod(int workPeriod) {
|
||||
return employeesPerWorkPeriod[workPeriod];
|
||||
}
|
||||
|
||||
public int getWorkingPeriodsPerPartTimeEmployees(int employee) {
|
||||
return workingPeriodsPerPartTimeEmployees[employee];
|
||||
}
|
||||
|
||||
public int getWorkingPeriodsPerFullTimeEmployees(int employee) {
|
||||
return workingPeriodsPerFullTimeEmployees[employee];
|
||||
}
|
||||
}
|
120
Travail_de_session/SchedulesWindows/ShowSchedulesFrame.form
Normal file
120
Travail_de_session/SchedulesWindows/ShowSchedulesFrame.form
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="mainPanel" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="mainPanel" pref="900" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="mainPanel">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1400, 1000]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="changeScheduleNumberScrollBar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" pref="115" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="textSolutionNumber" min="-2" pref="81" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="1166" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textSolutionNumber" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="changeScheduleNumberScrollBar" min="-2" pref="900" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="900" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JScrollBar" name="changeScheduleNumberScrollBar">
|
||||
<Events>
|
||||
<EventHandler event="adjustmentValueChanged" listener="java.awt.event.AdjustmentListener" parameters="java.awt.event.AdjustmentEvent" handler="changeScheduleNumberScrollBarAdjustmentValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="scheduleViewerArea">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Solution number"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="textSolutionNumber">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
139
Travail_de_session/SchedulesWindows/ShowSchedulesFrame.java
Normal file
139
Travail_de_session/SchedulesWindows/ShowSchedulesFrame.java
Normal file
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package SchedulesWindows;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author frabe
|
||||
*/
|
||||
public class ShowSchedulesFrame extends javax.swing.JFrame {
|
||||
|
||||
private List<ScheduleUtil.SchedulesArray> schedulesArrayList;
|
||||
private String title;
|
||||
/**
|
||||
* Creates new form ShowSchedulesFrame
|
||||
*/
|
||||
public ShowSchedulesFrame(List<ScheduleUtil.SchedulesArray> schedulesArrayList, String title) {
|
||||
this.schedulesArrayList = schedulesArrayList;
|
||||
this.title = title;
|
||||
initComponents();
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setTitle(title);
|
||||
setVisible(true);
|
||||
changeScheduleNumberScrollBar.setMinimum(1);
|
||||
int numberOfSchedules = this.schedulesArrayList.size();
|
||||
changeScheduleNumberScrollBar.setMaximum(numberOfSchedules);
|
||||
changeScheduleNumberScrollBar.setBlockIncrement(numberOfSchedules/10);
|
||||
changeScheduleNumberScrollBar.setVisibleAmount(numberOfSchedules/10);
|
||||
changeScheduleNumberScrollBar.setUnitIncrement(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
mainPanel = new javax.swing.JPanel();
|
||||
changeScheduleNumberScrollBar = new javax.swing.JScrollBar();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
scheduleViewerArea = new javax.swing.JTextArea();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
textSolutionNumber = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setPreferredSize(new java.awt.Dimension(1400, 1000));
|
||||
|
||||
mainPanel.setPreferredSize(new java.awt.Dimension(1400, 1000));
|
||||
|
||||
changeScheduleNumberScrollBar.addAdjustmentListener(new java.awt.event.AdjustmentListener() {
|
||||
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
|
||||
changeScheduleNumberScrollBarAdjustmentValueChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
scheduleViewerArea.setEditable(false);
|
||||
scheduleViewerArea.setColumns(20);
|
||||
scheduleViewerArea.setRows(5);
|
||||
jScrollPane1.setViewportView(scheduleViewerArea);
|
||||
|
||||
jLabel1.setText("Solution number");
|
||||
|
||||
textSolutionNumber.setText("0");
|
||||
|
||||
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
|
||||
mainPanel.setLayout(mainPanelLayout);
|
||||
mainPanelLayout.setHorizontalGroup(
|
||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
||||
.addComponent(changeScheduleNumberScrollBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1))
|
||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(textSolutionNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 1166, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
mainPanelLayout.setVerticalGroup(
|
||||
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
|
||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(textSolutionNumber))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(changeScheduleNumberScrollBar, javax.swing.GroupLayout.PREFERRED_SIZE, 900, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(mainPanelLayout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 900, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(mainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 900, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void changeScheduleNumberScrollBarAdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_changeScheduleNumberScrollBarAdjustmentValueChanged
|
||||
// TODO add your handling code here:
|
||||
int scrollBarValue = evt.getValue();
|
||||
textSolutionNumber.setText(String.valueOf(scrollBarValue));
|
||||
refreshScheduleText(scrollBarValue);
|
||||
}//GEN-LAST:event_changeScheduleNumberScrollBarAdjustmentValueChanged
|
||||
|
||||
private void refreshScheduleText(int scrollBarValue) {
|
||||
scheduleViewerArea.setText(ScheduleUtil.PrintSchedules.getFormattedSchedule(schedulesArrayList.get(scrollBarValue-1)));
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollBar changeScheduleNumberScrollBar;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JPanel mainPanel;
|
||||
private javax.swing.JTextArea scheduleViewerArea;
|
||||
private javax.swing.JLabel textSolutionNumber;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
Loading…
Reference in a new issue