aboutsummaryrefslogtreecommitdiff
path: root/structure/Router.java
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-21 13:20:41 +0100
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-21 13:20:41 +0100
commit8511b3af4778da926634742941d7893b46697c51 (patch)
treea479016d258dacf00689c01f1bd9e39e74c333f0 /structure/Router.java
parente3006549a89d471fc89559dd38ddbf600185920b (diff)
parent0676d16b3a5c13e2b75e97e7140b938b323cd79e (diff)
Merge branch 'master' into develop
Diffstat (limited to 'structure/Router.java')
-rw-r--r--structure/Router.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/structure/Router.java b/structure/Router.java
new file mode 100644
index 0000000..d977471
--- /dev/null
+++ b/structure/Router.java
@@ -0,0 +1,38 @@
+package structure;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class Router {
+
+ private static int id=-1;
+ public String name;
+ private HashMap<Router,Integer> links=new HashMap<>();
+
+ public Router() {
+ // TODO Auto-generated constructor stub
+ id++;
+ this.name=""+id;
+ }
+
+ 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);
+ }
+
+ public HashMap<Router, Integer> getLinks() {
+ return links;
+ }
+
+ public void setLinks(HashMap<Router, Integer> links) {
+ this.links = links;
+ }
+}