UserSelection Round Robin
This commit is contained in:
parent
1131299232
commit
60c2e5c69b
@ -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<User> 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<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));
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user