// ------------------------------------------------------------------------ // *****---Packet Recieved event handler---******// // this function will be called by the thread running the packetReciever // everytime a new packet is recieved // make sure it is synchronized if it modifies any of your data public synchronized void PacketReceived(PacketEvent e) { // this function defines what you do when a new packet is heard by the system (recall that the // parent class (PacketAnalyzer) already registered you to listen for new packets automatically) // if this is a long function, you should call it in a seperate thread to allow the // PacketReciever thread to continue recieving packets Packet packet = e.GetPacket(); Vector node_list = packet.CreateRoutePathArray(); for (int i = 0; i < node_list.size() - 1; i++) { Integer currentNodeNumber = (Integer) node_list.elementAt(i); NodeInfo currentNodeInfo; if ((currentNodeInfo = (NodeInfo) proprietaryNodeInfo.get(currentNodeNumber)) != null) { currentNodeInfo.SetValue(packet.getValue()); } } }