diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index afcc157..b72c2c1 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -86,9 +86,14 @@ public class AccessPoint { } private void analyseData() throws IOException { - FileOutputStream file = new FileOutputStream("data.csv", true); - // file.write("data1;data2".getBytes()); - file.close(); + try(FileOutputStream file = new FileOutputStream("data.csv", true)) { + for(int i = 0; i < frame.length; i++) { + for(int j = 0; j < frame[i].length; j++) { + ResourceBlock ur = frame[i][j]; + file.write((i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n").getBytes()); + } + } + } } private void plotData() { diff --git a/src/main/java/fr/ntr/ResourceBlock.java b/src/main/java/fr/ntr/ResourceBlock.java index 588e40e..4fcc575 100644 --- a/src/main/java/fr/ntr/ResourceBlock.java +++ b/src/main/java/fr/ntr/ResourceBlock.java @@ -2,18 +2,26 @@ package fr.ntr; public class ResourceBlock { private User user; - private double bandwith; + private double bandwidth; - public ResourceBlock (User user, double bandwith) { + public ResourceBlock (User user, double bandwidth) { this.user = user; - this.bandwith = bandwith; + this.bandwidth = bandwidth; } public void setUser(User user) { this.user = user; } - public void setBandwith(double bandwith) { - this.bandwith = bandwith; + public void setBandwidth(double bandwidth) { + this.bandwidth = bandwidth; + } + + public User getUser() { + return user; + } + + public double getBandwidth() { + return bandwidth; } }