blob: 6f5a1c5b538d73c87a0774851533948b28325f58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
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;
public class Main {
public static void main(String[] args) {
//Grid g=new Grid(Grid.Protocol.AODV);
// Build Graph for graphstream
//MyGraph gr=new MyGraph("Routage Oportuniste", g);
//gr.display();
//gr.update();
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<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());
}
}
}
}
|