routage-optimiste/main/Main.java

61 lines
1.2 KiB
Java
Raw Normal View History

2016-02-23 13:34:10 +01:00
package main;
2016-04-07 20:36:17 +02:00
import structure.*;
2016-03-14 16:35:31 +01:00
2016-04-07 20:36:17 +02:00
/**
* Main class
* @author loic, adama, othmane, saad
*
*/
2016-02-23 13:34:10 +01:00
public class Main {
2016-04-07 20:36:17 +02:00
/**
* Main
* @param args
*/
2016-02-23 13:34:10 +01:00
public static void main(String[] args) {
2016-03-29 10:46:36 +02:00
2016-04-07 20:36:17 +02:00
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
2016-03-21 13:06:19 +01:00
2016-04-07 20:36:17 +02:00
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
2016-03-29 11:42:05 +02:00
2016-04-07 20:36:17 +02:00
// Display all graph
gD.display();
g2D.display();
g3D.display();
// Update Graph
for(int i=0;i<20;i++){
2016-04-07 20:22:05 +02:00
2016-04-07 20:36:17 +02:00
// Sleep
2016-04-07 20:22:05 +02:00
try {
2016-04-07 20:36:17 +02:00
Thread.sleep(1000);
2016-04-07 20:22:05 +02:00
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
2016-04-07 20:36:17 +02:00
// 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());
2016-04-07 20:22:05 +02:00
2016-03-29 11:42:05 +02:00
}
2016-04-07 20:36:17 +02:00
2016-02-23 13:34:10 +01:00
}
2016-04-07 20:36:17 +02:00
2016-02-23 13:34:10 +01:00
}