cleaning round robin
This commit is contained in:
parent
e90ad76510
commit
163d04be7b
@ -34,16 +34,16 @@ public class RoundRobin extends Scheduler {
|
||||
//Pour chaque time slot et sous porteuses
|
||||
for (int Ts = 0; Ts < AccessPoint.getTimeSlotNb(); Ts++) {
|
||||
for(int Sp = 0; Sp < AccessPoint.getSubCarrierNb(); Sp++) {
|
||||
if (users.get(index).getPacketsToSend() == null) {
|
||||
users.remove(index);
|
||||
}else{
|
||||
|
||||
//TO Verify sub the packet send need Set packet
|
||||
// on enleve le packet transmis de la liste
|
||||
// TO Verify sub the packet send need Set packet
|
||||
users.get(index).getPacketsSent().add(users.get(index).getPacketsToSend().get(0));
|
||||
users.get(index).getPacketsToSend().remove(users.get(index).getPacketsToSend().get(0));
|
||||
}
|
||||
//on ajoute l'utilisateur a la frame
|
||||
frame[Ts][Sp].setUser(UserSelection(Ts, Sp, users));
|
||||
|
||||
//si un utilisateur n'a plus de packet a transmettre on supprime l'utilisateur de la liste
|
||||
if (users.get(index).getPacketsToSend() == null) {
|
||||
users.remove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,12 +53,13 @@ public class RoundRobin extends Scheduler {
|
||||
* Return the user in function of TS and SP selected
|
||||
*/
|
||||
private User UserSelection(int Ts, int Sp, List<User> users) {
|
||||
|
||||
//compte le nombre de bloc attribue
|
||||
for (int i = 0; i < Ts; i++){
|
||||
for (int j = 0; j < Sp; j++) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//on retourne l'utilisateur
|
||||
return users.get(index%(users.size() - 1));
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user