Add live
This commit is contained in:
parent
f453154938
commit
0e1704bbcb
4 changed files with 71 additions and 21 deletions
structure
|
@ -15,7 +15,15 @@ public class Router {
|
|||
this.name=""+id;
|
||||
}
|
||||
|
||||
public void resetLinks(){
|
||||
this.links=new HashMap<>();
|
||||
}
|
||||
|
||||
public void buildLink(Router router, int weight){
|
||||
this.links.remove(router);
|
||||
router.removeLink(this);
|
||||
|
||||
|
||||
this.links.put(router, weight);
|
||||
router.addLink(this, weight);
|
||||
}
|
||||
|
@ -32,6 +40,10 @@ public class Router {
|
|||
return links;
|
||||
}
|
||||
|
||||
public void removeLink(Router router){
|
||||
this.links.remove(router);
|
||||
}
|
||||
|
||||
public void setLinks(HashMap<Router, Integer> links) {
|
||||
this.links = links;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue