From 0e1704bbcb3279e4779f09c06127a7c76cc8fb04 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 21 Mar 2016 18:02:31 +0100 Subject: Add live --- structure/Router.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'structure/Router.java') diff --git a/structure/Router.java b/structure/Router.java index d977471..fce5977 100644 --- a/structure/Router.java +++ b/structure/Router.java @@ -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 links) { this.links = links; } -- cgit v1.2.3