Main instancie frame et le donne au scheduler et AccessPoint

This commit is contained in:
Loris 2023-03-17 10:45:55 +01:00
parent 254dbefde5
commit cdbb056bed
3 changed files with 13 additions and 6 deletions

View File

@ -31,12 +31,14 @@ public class AccessPoint {
private final double min, max; private final double min, max;
public AccessPoint(Scheduler scheduler, double min, double max) { public AccessPoint(Scheduler scheduler, ResourceBlock[][] frame, int timeSlotNb, int subCarrierNb, double min, double max) {
this.min = min; this.min = min;
this.max = max; this.max = max;
this.users = new ArrayList<>(); this.users = new ArrayList<>();
this.scheduler = scheduler; this.scheduler = scheduler;
this.frame = new ResourceBlock[timeSlotNb][subCarrierNb]; this.frame = frame;
this.timeSlotNb = timeSlotNb;
this.subCarrierNb = subCarrierNb;
} }
/** /**

View File

@ -1,11 +1,11 @@
package fr.ntr; package fr.ntr;
import fr.ntr.scheduler.RoundRobin; import fr.ntr.scheduler.RoundRobin;
import fr.ntr.scheduler.Scheduler;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
//TODO ajouter accès à AccessPoint
if(args.length == 2) { if(args.length == 2) {
int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation
@ -19,8 +19,12 @@ public class Main {
System.exit(1); System.exit(1);
return; return;
} }
//TODO : change timeSlotNb and subCarrierNb
AccessPoint accessPoint = new AccessPoint(new RoundRobin("round robin", 0), 0, 50); int timeSlotNb = 0;
int subCarrierNb = 0;
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
Scheduler scheduler = new RoundRobin("round robin", 0, frame);
AccessPoint accessPoint = new AccessPoint(scheduler, frame, timeSlotNb, subCarrierNb, 0, 50);
accessPoint.startSimulation(numberOfTicks, maximumLoad); accessPoint.startSimulation(numberOfTicks, maximumLoad);
} else { } else {
System.err.println("Please give launch arguments"); System.err.println("Please give launch arguments");

View File

@ -15,9 +15,10 @@ public class RoundRobin extends Scheduler {
private List<User> users; private List<User> users;
private ResourceBlock[][] frame; private ResourceBlock[][] frame;
public RoundRobin(String name, int index) { public RoundRobin(String name, int index, ResourceBlock[][] frame) {
this.name = name; this.name = name;
this.index = index; this.index = index;
this.frame = frame;
} }
/** /**