Sim
Class Node

java.lang.Object
  extended by Sim.Node

public class Node
extends java.lang.Object

Node is the central object of the simulation, which tracks its location and keeps a RoutingAlgorithm.


Constructor Summary
Node(int address, Simulation sim, LocationManager locationManager, RoutingAlgorithm routingAlg, double transmissionRange, NodeMonitor monitor)
           
 
Method Summary
 int getAddress()
           
 Location getLocation()
          Returns the current location for this Node, based on the Simulation's current time.
 double getPowerUsed()
           
 double getTransmissionRange()
           
 void receiveFrame(HardwareFrame frame)
          Occurs when a node receives a frame.
 void sendFrame(HardwareFrame frame)
          Queues a HardwareFrame to be sent by this node.
 void sendNewPacket(Node destination, Packet packet)
          Originates a new Packet to be sent to the given destination.
 void sendNewPacket(Packet packet)
          Originates a new Packet to be sent.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(int address,
            Simulation sim,
            LocationManager locationManager,
            RoutingAlgorithm routingAlg,
            double transmissionRange,
            NodeMonitor monitor)
Method Detail

getLocation

public Location getLocation()
Returns the current location for this Node, based on the Simulation's current time.

Returns:
non-null Location

getAddress

public int getAddress()

getTransmissionRange

public double getTransmissionRange()

getPowerUsed

public double getPowerUsed()

receiveFrame

public void receiveFrame(HardwareFrame frame)
Occurs when a node receives a frame. Based on the contents of the frame, passes to the appropriate RoutingAlgorithm method.

Parameters:
frame - non-null HardwareFrame

sendNewPacket

public void sendNewPacket(Node destination,
                          Packet packet)
Originates a new Packet to be sent to the given destination. The addresses in the Packet must correspond properly with this Node and the destination Node. A packet origination event occurs in this method.

Parameters:
destination - non-null destination Node
packet - non-null Packet to send, with proper addresses set

sendNewPacket

public void sendNewPacket(Packet packet)
Originates a new Packet to be sent. The addresses in the Packet must correspond properly with this Node and a valid destination Node in the Simulation's World. A packet origination event occurs in this method.

Parameters:
packet - non-null Packet to send, with proper addresses set

sendFrame

public void sendFrame(HardwareFrame frame)
Queues a HardwareFrame to be sent by this node. Currently this method does not support hacking via forged frames.

Parameters:
frame - non-null HardwareFrame with source address equal to this node

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object