Sim.Routing.GPSR.Header
Class Broadcast

java.lang.Object
  extended by Sim.Routing.GPSR.Header.Broadcast
All Implemented Interfaces:
ProtocolFrame, Base

public class Broadcast
extends java.lang.Object
implements Base

This is a broadcast header that tells other nodes who this is and what their location is.


Field Summary
 PacketId id
           
 
Constructor Summary
Broadcast(PacketId pid, int fromAddress, Location fromLocation)
          The constructor to create a new frame for broadcasting to other nodes my current location and address.
 
Method Summary
 int getFromAddress()
          The address of the node that sent this header.
 Location getFromLocation()
          The location of the node that sent this header.
 int getSize()
          Returns the "serialized" size of this portion of the packet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public PacketId id
Constructor Detail

Broadcast

public Broadcast(PacketId pid,
                 int fromAddress,
                 Location fromLocation)
The constructor to create a new frame for broadcasting to other nodes my current location and address.

Parameters:
fromAddress - the address of node this was sent from, purely for updating neighbors.
fromLocation - the location of the sender node, purely for updating neighbors.
Method Detail

getSize

public int getSize()
Returns the "serialized" size of this portion of the packet.

Specified by:
getSize in interface ProtocolFrame

getFromAddress

public int getFromAddress()
The address of the node that sent this header.

Specified by:
getFromAddress in interface Base
Returns:
int of address of sender.

getFromLocation

public Location getFromLocation()
The location of the node that sent this header.

Specified by:
getFromLocation in interface Base
Returns:
location object of coordinates of originator node.