UserSelection Round Robin

This commit is contained in:
iboyeau 2023-03-09 11:04:42 +01:00
parent 1131299232
commit 60c2e5c69b

View File

@ -1,33 +1,39 @@
package fr.ntr.scheduler; package fr.ntr.scheduler;
import java.util.List; import java.util.List;
import java.util.Random;
import fr.ntr.User; import fr.ntr.User;
public class RoundRobin extends Scheduler { public class RoundRobin extends Scheduler {
private String name; private String name;
private int index; private int index;
public RoundRobin(String name, int index) {
this.name = name;
this.index = index;
}
@Override
public void scheduling() {
}
//Ts = Time Slot
//Sp =sous porteuse
private void selectionUtilisateur(int Ts, int Sp, List<User> Users) {
int random = new Random().nextInt(0, Users.size()-1);
}
public RoundRobin(String name, int index) {
this.name = name;
this.index = index;
}
/**
* Entry
* Return
*/
@Override
public void scheduling() {
index = 0;
}
/**
* Entry Time slot (int), Sous porteuse(int), and users ( List<User>)
* Return the user in function of TS and SP selected
*/
private User UserSelection(int Ts, int Sp, List<User> Users) {
for (int i = 0; i < Ts; i++) {
for (int j = 0; j < Sp; j++) {
index++;
}
}
return Users.get(index%(Users.size() - 1));
}
} }