Rename User

This commit is contained in:
Remi Boure 2023-03-10 10:50:46 +01:00
parent 20802f0658
commit aa7be85663
7 changed files with 21 additions and 19 deletions

View File

@ -7,7 +7,7 @@ import java.util.Random;
import fr.ntr.scheduler.Scheduler; import fr.ntr.scheduler.Scheduler;
public class AccessPoint { public class AccessPoint {
private List<UserGroup> users; private List<User> users;
private Scheduler scheduler; private Scheduler scheduler;
/** /**
* nombre de slots * nombre de slots
@ -58,14 +58,16 @@ public class AccessPoint {
* Génération du débit et des paquets * Génération du débit et des paquets
*/ */
private void init(int nbUsers) { private void init(int nbUsers) {
double[] distance = { 200d, 500d }; double[] distance = { 200d, 1000d };
for (int i = 0; i < nbUsers; i++) { for (int i = 0; i < distance.length; i++) {
UserGroup user = new UserGroup(distance[i], timeSlotNb, subCarrierNb); for(int j = 0; j < nbUsers; j++){
User user = new User(distance[i], timeSlotNb, subCarrierNb);
user.generateBandwidth(); user.generateBandwidth();
user.createPackets(); user.createPackets();
this.users.add(user); this.users.add(user);
} }
} }
}
private void schedule() { private void schedule() {

View File

@ -5,9 +5,9 @@ public class Packets {
private int creationTime; private int creationTime;
private int endTimeSending; private int endTimeSending;
private double bitsNumberRemaining; 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.creationTime = creationTime;
this.endTimeSending = endTimeSending; this.endTimeSending = endTimeSending;
this.bitsNumberRemaining = bitsNumberRemaining; this.bitsNumberRemaining = bitsNumberRemaining;

View File

@ -1,10 +1,10 @@
package fr.ntr; package fr.ntr;
public class ResourceBlock { public class ResourceBlock {
private UserGroup user; private User user;
private double bandwith; private double bandwith;
public ResourceBlock (UserGroup user, double bandwith) { public ResourceBlock (User user, double bandwith) {
this.user = user; this.user = user;
this.bandwith = bandwith; this.bandwith = bandwith;
} }

View File

@ -3,14 +3,14 @@ package fr.ntr;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class UserGroup { public class User {
private final double distance; private final double distance;
private final double[][] bandwidthTable; private final double[][] bandwidthTable;
private final List<Packets> packetsToSend; private final List<Packets> packetsToSend;
private final List<Packets> packetsSent; private final List<Packets> packetsSent;
public UserGroup(double distance, int timeSlotNb, int subCarrierNb) { public User(double distance, int timeSlotNb, int subCarrierNb) {
this.distance = distance; this.distance = distance;
this.bandwidthTable = new double[timeSlotNb][subCarrierNb]; this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
this.packetsToSend = new ArrayList<>(); this.packetsToSend = new ArrayList<>();

View File

@ -1,6 +1,6 @@
package fr.ntr.scheduler; package fr.ntr.scheduler;
import java.util.List; import java.util.List;
import fr.ntr.UserGroup; import fr.ntr.User;
public class MaxSNR extends Scheduler { public class MaxSNR extends Scheduler {
@ -11,7 +11,7 @@ public class MaxSNR extends Scheduler {
public void scheduling() { public void scheduling() {
} }
private void selectionUtilisateur(int Ts, int Sp, List<UserGroup> Users) { private void selectionUtilisateur(int Ts, int Sp, List<User> Users) {
} }

View File

@ -2,7 +2,7 @@ package fr.ntr.scheduler;
import java.util.List; import java.util.List;
import fr.ntr.UserGroup; import fr.ntr.User;
public class ProportionalFair extends Scheduler { public class ProportionalFair extends Scheduler {
@ -18,7 +18,7 @@ public class ProportionalFair extends Scheduler {
public void scheduling() { public void scheduling() {
} }
private void selectionUtilisateur(int Ts, int Sp, List<UserGroup> Users) { private void selectionUtilisateur(int Ts, int Sp, List<User> Users) {
} }

View File

@ -1,6 +1,6 @@
package fr.ntr.scheduler; package fr.ntr.scheduler;
import java.util.List; import java.util.List;
import fr.ntr.UserGroup; import fr.ntr.User;
public class RoundRobin extends Scheduler { public class RoundRobin extends Scheduler {
@ -27,7 +27,7 @@ public class RoundRobin extends Scheduler {
* Entry Time slot (int), Sous porteuse(int), and users ( List<User>) * Entry Time slot (int), Sous porteuse(int), and users ( List<User>)
* Return the user in function of TS and SP selected * Return the user in function of TS and SP selected
*/ */
private UserGroup UserSelection(int Ts, int Sp, List<UserGroup> Users) { private User UserSelection(int Ts, int Sp, List<User> Users) {
for (int i = 0; i < Ts; i++) { for (int i = 0; i < Ts; i++) {
for (int j = 0; j < Sp; j++) { for (int j = 0; j < Sp; j++) {
index++; index++;