UserSelection Round Robin

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

View File

@ -1,6 +1,5 @@
package fr.ntr.scheduler;
import java.util.List;
import java.util.Random;
import fr.ntr.User;
@ -14,20 +13,27 @@ public class RoundRobin extends Scheduler {
this.index = index;
}
/**
* Entry
* Return
*/
@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);
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));
}
}