Ajout affichage meilleur chemin
This commit is contained in:
parent
0676d16b3a
commit
9cb19346da
2 changed files with 62 additions and 4 deletions
|
@ -131,7 +131,7 @@ public class Grid {
|
|||
return currentBestLink;
|
||||
}
|
||||
|
||||
private int getMaxBottleneck(ArrayList<Integer> link){
|
||||
/*private int getMaxBottleneck(ArrayList<Integer> link){
|
||||
int max=this.getWeigthOfLink(link.get(0), link.get(1));
|
||||
for(int j=1;j<link.size()-1;j++){
|
||||
int currentMax=this.getWeigthOfLink(link.get(j), link.get(j+1));
|
||||
|
@ -139,6 +139,17 @@ public class Grid {
|
|||
max=currentMax;
|
||||
}
|
||||
|
||||
}
|
||||
return max;
|
||||
}*/
|
||||
private int getMaxBottleneck(ArrayList<Integer> link){
|
||||
int max=this.getWeigthOfLink(link.get(0), link.get(1));
|
||||
for(int j=1;j<link.size()-1;j++){
|
||||
int currentMax=this.getWeigthOfLink(link.get(j), link.get(j+1));
|
||||
if(max>currentMax){
|
||||
max=currentMax;
|
||||
}
|
||||
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
@ -153,14 +164,46 @@ public class Grid {
|
|||
ArrayList<Integer> link=this.links.get(i);
|
||||
System.out.print("Link number " + i + " ==> ");
|
||||
for(int j=0;j<link.size()-1;j++){
|
||||
//System.out.print(this.getWeigthOfLink(link.get(j), link.get(j+1)) + " ");
|
||||
System.out.print(this.getWeigthOfLink(link.get(j), link.get(j+1)) + " ");
|
||||
}
|
||||
System.out.println(this.getMaxBottleneck(link));
|
||||
System.out.println(" Goulot :"+this.getMaxBottleneck(link));
|
||||
//System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean isEdgeOfLink(ArrayList<Integer>link, Router src, Router dest){
|
||||
for(int j=0;j<link.size()-1;j++){
|
||||
Router current=this.grid.get(link.get(j));
|
||||
if(src.name.equals(current.name)){
|
||||
if(j<link.size()-1){
|
||||
Router currentDest=this.grid.get(link.get(j+1));
|
||||
|
||||
if(currentDest.name.equals(dest.name)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int j=0;j<link.size()-1;j++){
|
||||
Router current=this.grid.get(link.get(j));
|
||||
if(dest.name.equals(current.name)){
|
||||
if(j<link.size()-1){
|
||||
Router currentDest=this.grid.get(link.get(j+1));
|
||||
|
||||
if(currentDest.name.equals(src.name)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArrayList<Router> getGrid() {
|
||||
return grid;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue