From aa7be85663ab3b4712779ab380b9d2644ace9ef2 Mon Sep 17 00:00:00 2001 From: Remi Boure Date: Fri, 10 Mar 2023 10:50:46 +0100 Subject: [PATCH] Rename User --- src/main/java/fr/ntr/AccessPoint.java | 16 +++++++++------- src/main/java/fr/ntr/Packets.java | 4 ++-- src/main/java/fr/ntr/ResourceBlock.java | 4 ++-- .../java/fr/ntr/{UserGroup.java => User.java} | 4 ++-- src/main/java/fr/ntr/scheduler/MaxSNR.java | 4 ++-- .../java/fr/ntr/scheduler/ProportionalFair.java | 4 ++-- src/main/java/fr/ntr/scheduler/RoundRobin.java | 4 ++-- 7 files changed, 21 insertions(+), 19 deletions(-) rename src/main/java/fr/ntr/{UserGroup.java => User.java} (93%) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 3cdca29..7e54cda 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -7,7 +7,7 @@ import java.util.Random; import fr.ntr.scheduler.Scheduler; public class AccessPoint { - private List users; + private List users; private Scheduler scheduler; /** * nombre de slots @@ -58,12 +58,14 @@ public class AccessPoint { * Génération du débit et des paquets */ private void init(int nbUsers) { - double[] distance = { 200d, 500d }; - for (int i = 0; i < nbUsers; i++) { - UserGroup user = new UserGroup(distance[i], timeSlotNb, subCarrierNb); - user.generateBandwidth(); - user.createPackets(); - this.users.add(user); + double[] distance = { 200d, 1000d }; + for (int i = 0; i < distance.length; i++) { + for(int j = 0; j < nbUsers; j++){ + User user = new User(distance[i], timeSlotNb, subCarrierNb); + user.generateBandwidth(); + user.createPackets(); + this.users.add(user); + } } } diff --git a/src/main/java/fr/ntr/Packets.java b/src/main/java/fr/ntr/Packets.java index deac3ea..d52ecab 100644 --- a/src/main/java/fr/ntr/Packets.java +++ b/src/main/java/fr/ntr/Packets.java @@ -5,9 +5,9 @@ public class Packets { private int creationTime; private int endTimeSending; private double bitsNumberRemaining; - private UserGroup user; + private User user; - public Packets(int creationTime, int endTimeSending, double bitsNumberRemaining, UserGroup user){ + public Packets(int creationTime, int endTimeSending, double bitsNumberRemaining, User user){ this.creationTime = creationTime; this.endTimeSending = endTimeSending; this.bitsNumberRemaining = bitsNumberRemaining; diff --git a/src/main/java/fr/ntr/ResourceBlock.java b/src/main/java/fr/ntr/ResourceBlock.java index dc2aebe..ec0bc6d 100644 --- a/src/main/java/fr/ntr/ResourceBlock.java +++ b/src/main/java/fr/ntr/ResourceBlock.java @@ -1,10 +1,10 @@ package fr.ntr; public class ResourceBlock { - private UserGroup user; + private User user; private double bandwith; - public ResourceBlock (UserGroup user, double bandwith) { + public ResourceBlock (User user, double bandwith) { this.user = user; this.bandwith = bandwith; } diff --git a/src/main/java/fr/ntr/UserGroup.java b/src/main/java/fr/ntr/User.java similarity index 93% rename from src/main/java/fr/ntr/UserGroup.java rename to src/main/java/fr/ntr/User.java index a86c95f..51e5ace 100644 --- a/src/main/java/fr/ntr/UserGroup.java +++ b/src/main/java/fr/ntr/User.java @@ -3,14 +3,14 @@ package fr.ntr; import java.util.ArrayList; import java.util.List; -public class UserGroup { +public class User { private final double distance; private final double[][] bandwidthTable; private final List packetsToSend; private final List packetsSent; - public UserGroup(double distance, int timeSlotNb, int subCarrierNb) { + public User(double distance, int timeSlotNb, int subCarrierNb) { this.distance = distance; this.bandwidthTable = new double[timeSlotNb][subCarrierNb]; this.packetsToSend = new ArrayList<>(); diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index 3f2c3e6..41e0ceb 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -1,6 +1,6 @@ package fr.ntr.scheduler; import java.util.List; -import fr.ntr.UserGroup; +import fr.ntr.User; public class MaxSNR extends Scheduler { @@ -11,7 +11,7 @@ public class MaxSNR extends Scheduler { public void scheduling() { } - private void selectionUtilisateur(int Ts, int Sp, List Users) { + private void selectionUtilisateur(int Ts, int Sp, List Users) { } diff --git a/src/main/java/fr/ntr/scheduler/ProportionalFair.java b/src/main/java/fr/ntr/scheduler/ProportionalFair.java index 5bb98e0..1e0b650 100644 --- a/src/main/java/fr/ntr/scheduler/ProportionalFair.java +++ b/src/main/java/fr/ntr/scheduler/ProportionalFair.java @@ -2,7 +2,7 @@ package fr.ntr.scheduler; import java.util.List; -import fr.ntr.UserGroup; +import fr.ntr.User; public class ProportionalFair extends Scheduler { @@ -18,7 +18,7 @@ public class ProportionalFair extends Scheduler { public void scheduling() { } - private void selectionUtilisateur(int Ts, int Sp, List Users) { + private void selectionUtilisateur(int Ts, int Sp, List Users) { } diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index f181539..331661f 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -1,6 +1,6 @@ package fr.ntr.scheduler; import java.util.List; -import fr.ntr.UserGroup; +import fr.ntr.User; public class RoundRobin extends Scheduler { @@ -27,7 +27,7 @@ public class RoundRobin extends Scheduler { * Entry Time slot (int), Sous porteuse(int), and users ( List) * Return the user in function of TS and SP selected */ - private UserGroup UserSelection(int Ts, int Sp, List Users) { + private User UserSelection(int Ts, int Sp, List Users) { for (int i = 0; i < Ts; i++) { for (int j = 0; j < Sp; j++) { index++;