27 lines
509 B
Java
27 lines
509 B
Java
package structure;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
|
|
public class Router {
|
|
|
|
|
|
private HashMap<Router,Integer> links=new HashMap<>();
|
|
|
|
public Router() {
|
|
// TODO Auto-generated constructor stub
|
|
}
|
|
|
|
public void buildLink(Router router, int weight){
|
|
this.links.put(router, weight);
|
|
router.addLink(this, weight);
|
|
}
|
|
|
|
public void addLink(Router router, int weight){
|
|
this.links.put(router, weight);
|
|
}
|
|
|
|
public int getWeight(Router router){
|
|
return this.links.get(router);
|
|
}
|
|
}
|