aboutsummaryrefslogtreecommitdiff
path: root/main/Main.java
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-04-07 20:36:17 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-04-07 20:36:17 +0200
commitac90cc95816e599902e5505f47198cfb79d48a64 (patch)
treef9c37cebd6fe6f71431a874e72cafd549020e020 /main/Main.java
parentf4e0747e5991736f64aef06883e41eaefdf3f7a3 (diff)
Clean code and add commentdevelop
Diffstat (limited to 'main/Main.java')
-rw-r--r--main/Main.java107
1 files changed, 40 insertions, 67 deletions
diff --git a/main/Main.java b/main/Main.java
index 6f5a1c5..b2d9243 100644
--- a/main/Main.java
+++ b/main/Main.java
@@ -1,87 +1,60 @@
package main;
-import java.awt.Label;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.graphstream.graph.Edge;
-import org.graphstream.graph.Graph;
-import org.graphstream.graph.implementations.SingleGraph;
-import org.graphstream.ui.layout.springbox.EdgeSpring;
-import org.graphstream.ui.swingViewer.basicRenderer.EdgeRenderer;
-import org.graphstream.ui.util.EdgePoints;
-
-import structure.Grid;
-import structure.MyGraph;
-import structure.Router;
+import structure.*;
+/**
+ * Main class
+ * @author loic, adama, othmane, saad
+ *
+ */
public class Main {
+ /**
+ * Main
+ * @param args
+ */
public static void main(String[] args) {
- //Grid g=new Grid(Grid.Protocol.AODV);
-
+ Grid g=new Grid(Grid.Protocol.AODV); // Graph for AODV
+ Grid g2=new Grid(Grid.Protocol.DSDV); // Graph for DSDV
+ Grid g3=new Grid(Grid.Protocol.CUSTOM); // Graph for custom
- // Build Graph for graphstream
- //MyGraph gr=new MyGraph("Routage Oportuniste", g);
- //gr.display();
- //gr.update();
+ MyGraph gD=new MyGraph("AODV", g); // GUI for g
+ MyGraph g2D=new MyGraph("DSDV", g2); // GUI for g2
+ MyGraph g3D=new MyGraph("CUSTOM", g3); // GUI for g3
- for(int j=0;j<1;j++){
- Grid g=new Grid(Grid.Protocol.AODV);
- Grid g2=new Grid(Grid.Protocol.DSDV);
- Grid g3=new Grid(Grid.Protocol.CUSTOM);
-
- MyGraph gD=new MyGraph("AODV", g);
- MyGraph g2D=new MyGraph("DSDV", g2);
- MyGraph g3D=new MyGraph("CUSTOM", g3);
+ // Display all graph
+ gD.display();
+ g2D.display();
+ g3D.display();
+
+
+ // Update Graph
+ for(int i=0;i<20;i++){
- gD.display();
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- g2D.display();
+ // Sleep
try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- g3D.display();
- try {
- Thread.sleep(3000);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- // Update Graph
- for(int i=0;i<20;i++){
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- g.buildEdgeWithRandomWeigth();
- g2.buildEdgeWithRandomWeigth();
- g3.buildEdgeWithRandomWeigth();
-
-
- gD.update();
- g2D.update();
- g3D.update();
- //System.out.println("Update !");
- //gr.update();
- System.out.println("AODV :"+g.getDebitMoy() + " DSDV :"+g2.getDebitMoy()+" CUSTOM :"+g3.getDebitMoy());
+ // Change radio conditions
+ g.buildEdgeWithRandomWeigth();
+ g2.buildEdgeWithRandomWeigth();
+ g3.buildEdgeWithRandomWeigth();
+
+ // Update graph on GUI
+ gD.update();
+ g2D.update();
+ g3D.update();
+
+ // Display current debMoy for each graph
+ System.out.println("AODV :"+g.getDebitMoy() + " DSDV :"+g2.getDebitMoy()+" CUSTOM :"+g3.getDebitMoy());
- }
-
}
+
}
+
}