Sim
Interface PacketListener

All Known Implementing Classes:
PacketWatcher

public interface PacketListener

PacketListener is an interface for objects wanting to listen for Packet events.


Method Summary
 void packetArrived(Packet p, double time, boolean repeat)
          Event called when a Packet arrives at its destination.
 void packetOriginated(Packet p, double time)
          Event called when a Packet is given to a Node for sending.
 void reportTotalHops(Packet p, int hops, double distance)
          Event called when a Packet is is passed to a new node, including the terminating node.
 

Method Detail

packetOriginated

void packetOriginated(Packet p,
                      double time)
Event called when a Packet is given to a Node for sending. This event only occurs once for any given Packet.

Parameters:
p - non-null Packet
time - Time of origination.

reportTotalHops

void reportTotalHops(Packet p,
                     int hops,
                     double distance)
Event called when a Packet is is passed to a new node, including the terminating node.

Parameters:
p - non-null Packet
time - Time of origination.

packetArrived

void packetArrived(Packet p,
                   double time,
                   boolean repeat)
Event called when a Packet arrives at its destination. This method can happen multiple times if there is packet duplication. The first time a Packet arrives, repeat is false. All subsequent events, if they occur, repeat is true.

Parameters:
p - non-null Packet that arrived
time - Time of arrival, which is after time of origination for this Packet
repeat - true if another copy of the Packet arrived, false if first time.