aboutsummaryrefslogtreecommitdiff
path: root/main/Main.java
blob: b2d9243006b3e90f1c1c82cdd6fd7fa87d6d4c0a (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
package main;

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); // Graph for AODV
		Grid g2=new Grid(Grid.Protocol.DSDV); // Graph for DSDV
		Grid g3=new Grid(Grid.Protocol.CUSTOM); // Graph for custom

		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
		
		// Display all graph
		gD.display();
		g2D.display();
		g3D.display();
		
	
		// Update Graph
		for(int i=0;i<20;i++){
			
			// Sleep
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			// 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());

		}

	}
	
}