diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index 1db8218..331661f 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -1,33 +1,39 @@ package fr.ntr.scheduler; import java.util.List; -import java.util.Random; import fr.ntr.User; public class RoundRobin extends Scheduler { - private String name; - 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 Users) { - int random = new Random().nextInt(0, Users.size()-1); - - - } + private String name; + private int index; - + 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) + * Return the user in function of TS and SP selected + */ + private User UserSelection(int Ts, int Sp, List Users) { + for (int i = 0; i < Ts; i++) { + for (int j = 0; j < Sp; j++) { + index++; + } + } + return Users.get(index%(Users.size() - 1)); + + } }