aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-04-07 20:22:05 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-04-07 20:22:05 +0200
commitf4e0747e5991736f64aef06883e41eaefdf3f7a3 (patch)
tree4e7ab232609c5c49029a49a763abbe3aae549f29
parent313c51b76b750cdbc8d7bc94e209e7cabf515e8d (diff)
Test
-rw-r--r--main/Main.java44
-rw-r--r--structure/MyGraph.java1
2 files changed, 39 insertions, 6 deletions
diff --git a/main/Main.java b/main/Main.java
index 3023069..6f5a1c5 100644
--- a/main/Main.java
+++ b/main/Main.java
@@ -1,5 +1,6 @@
package main;
+import java.awt.Label;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -28,28 +29,59 @@ public class Main {
//gr.display();
//gr.update();
- for(int j=0;j<20;j++){
+ 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);
+
+ gD.display();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ g2D.display();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ g3D.display();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
// Update Graph
- for(int i=0;i<100;i++){
- /*try {
- Thread.sleep(10000);
+ 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());
+
}
- System.out.println("AODV :"+g.getDebitMoy() + " DSDV :"+g2.getDebitMoy()+" CUSTOM :"+g3.getDebitMoy());
}
}
}
diff --git a/structure/MyGraph.java b/structure/MyGraph.java
index be9e504..77a1f77 100644
--- a/structure/MyGraph.java
+++ b/structure/MyGraph.java
@@ -23,6 +23,7 @@ public class MyGraph extends SingleGraph{
super(title);
// Allow CSS on view
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
+
// Set graph CSS
this.addAttribute("ui.stylesheet", "url('resources/style.css')");