Change structure
This commit is contained in:
parent
7cb597989c
commit
e1375756dd
3 changed files with 149 additions and 14 deletions
27
structure/Router.java
Normal file
27
structure/Router.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue