1 25 26 package org.objectweb.speedo.pobjects.fetchgroup; 27 28 import java.util.HashMap ; 29 import java.util.Iterator ; 30 import java.util.Map ; 31 32 35 public class Node { 36 37 private String name; 38 private Map edges; 39 40 public Node(String name) { 41 this.name = name; 42 this.edges = new HashMap (); 43 } 44 45 48 public Map getEdges() { 49 return edges; 50 } 51 54 public void setEdges(Map edges) { 55 this.edges = edges; 56 } 57 60 public String getName() { 61 return name; 62 } 63 66 public void setName(String name) { 67 this.name = name; 68 } 69 70 public void addEdge(String name, EdgeWeight ew){ 71 edges.put(name, ew); 72 } 73 74 public String toString(){ 75 String s = name + " :"; 76 Iterator it = edges.keySet().iterator(); 77 while(it.hasNext()){ 78 String n = (String ) it.next(); 79 s += "(" + n + ","; 80 EdgeWeight ew = (EdgeWeight) edges.get(n); 81 if(ew != null) 82 s += ew.getWeight() + ") "; 83 else 84 s += "null)"; 85 } 86 return s; 87 } 88 } 89 | Popular Tags |