/* * Author: Wenbing Zhao * Last Modified: 3/31/2007 * For EEC484/584 Project */ import java.util.*; import java.net.*; import java.io.*; class Routed { private DijkstraEngine m_engine = null; private List m_nodeList = null; // list of nodes in this network private Map m_forwardingTable = null; private Node m_me = null; // Who am I? private DatagramSocket m_socket = null; public Routed(Node self, List nodelist, DenseRoutesMap map) { m_me = self; m_nodeList = nodelist; m_engine = new DijkstraEngine(map); m_forwardingTable = new HashMap(); // Run Dijkstra's Algorithm and determine my forwarding table populateForwardingTable(); printForwardingTable(); } public void printForwardingTable() { int size = m_nodeList.size(); for(int i=0; i 0) { String me = args[0]; char c = me.charAt(0); System.out.println("Node "+c); myNode = Node.valueOf(c); System.out.println("Node "+myNode); } }catch(Exception e) { System.err.println("Error parsing command line args"); System.exit(1); } Routed d = new Routed(myNode, nlist, testMap); d.runEventLoop(); } }