Sim.Routing.GPSR.Header
Class Standard

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

public class Standard
extends java.lang.Object
implements Base

This is the basic header that is needed by GPSR. It contains two modes which will use more or less fields. Mainly, for greedy routing, only the mode (obviously), toAddress, fromAddress and fromLocation (for updating purposes), and the finalLocationa are used.


Field Summary
 PacketId id
           
 
Constructor Summary
Standard(PacketId id, int mode, int fromAddress, Location fromLocation, Location finalLocation)
          The constructor to create a new frame for sending a packet to a destination.
Standard(PacketId id, int mode, int fromAddress, Location fromLocation, Location finalLocation, Location perimeterStarted)
           
 
Method Summary
 double getEdge()
           
 Location getFaceLocation()
           
 Location getFinalLocation()
          The end destination of the node that is to receive the packet.
 int getFromAddress()
          The address of the node that sent this header.
 Location getFromLocation()
          The location of the node that sent this header.
 int getMode()
          Return the mode that this packet is currently routing in.
 Location getPerimeterStarted()
           
 int getSize()
          Returns the "serialized" size of this portion of the packet.
 void setEdge(double edge)
           
 void setFaceLocation(Location faceLocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public final PacketId id
Constructor Detail

Standard

public Standard(PacketId id,
                int mode,
                int fromAddress,
                Location fromLocation,
                Location finalLocation)
The constructor to create a new frame for sending a packet to a destination.

Parameters:
id - a unique id for this frame.
mode - a field indicating if the packet is traveling in greedy or perimeter mode.
toAddress - the next node this header is intended for.
fromAddress - the address of node this was sent from, purely for updating neighbors.
fromLocation - the location of the sender node, purely for updating neighbors.
finalLocation - the end location that this is to be sent to.

Standard

public Standard(PacketId id,
                int mode,
                int fromAddress,
                Location fromLocation,
                Location finalLocation,
                Location perimeterStarted)
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.

getFinalLocation

public Location getFinalLocation()
The end destination of the node that is to receive the packet.

Returns:
location object of the final node.

getMode

public int getMode()
Return the mode that this packet is currently routing in.

Returns:
integer of the mode.

getPerimeterStarted

public Location getPerimeterStarted()

getFaceLocation

public Location getFaceLocation()

setFaceLocation

public void setFaceLocation(Location faceLocation)

getEdge

public double getEdge()

setEdge

public void setEdge(double edge)