60 lines
1.2 KiB
Java
60 lines
1.2 KiB
Java
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());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|