Class EmulatedNode

java.lang.Object
  extended by EmulatedNode

public class EmulatedNode
extends java.lang.Object

 Keeps track of information about an emulated node
 Emulated node uses a TCP socket to talk to the Trawler, but send and receive messages directly
 to other emulated nodes using UDP.
 


Constructor Summary
EmulatedNode(java.net.Socket socket, java.io.PrintWriter out, int fishAddr, java.net.InetAddress ipAddress, int port)
          Create a new EmulatedNode
 
Method Summary
 void close()
          Close the the connection to the emulated node
 int getFishAddr()
          Get the fishnet address of this node
 java.net.InetAddress getIPAddress()
          Get the IP address of the machine that this emulated node is on
 int getPort()
          Get the port that this emulated node is using to talk to its neighbors
 boolean isAlive()
          Check if the emulated node is still alive
 void putEdge(EmulatedNode peerNode)
          Tell the emulated node about one of its neighbors
 void removeEdge(int peerFishAddr)
          Tell the emulated node that one of its neighbors is gone
 void reset()
          Remove all edge's from this emulated node.
 java.lang.String toString()
          Return a string containing details of this emulated node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmulatedNode

public EmulatedNode(java.net.Socket socket,
                    java.io.PrintWriter out,
                    int fishAddr,
                    java.net.InetAddress ipAddress,
                    int port)
Create a new EmulatedNode

Parameters:
socket - The socket to use to talk to the emulated node
out - An outputstream to use to send data across the socket
fishAddr - The fishnet address of the emulated node
ipAddress - The IP address of the machine that the node is on
port - The port that the emulated node will use to talk to other nodes
Method Detail

putEdge

public void putEdge(EmulatedNode peerNode)
Tell the emulated node about one of its neighbors

Parameters:
peerNode - A neighbor of this node

removeEdge

public void removeEdge(int peerFishAddr)
Tell the emulated node that one of its neighbors is gone

Parameters:
peerFishAddr - The fishnet address of the neighbor

reset

public void reset()
Remove all edge's from this emulated node. Thus it loses all its neighbors


close

public void close()
Close the the connection to the emulated node


getFishAddr

public int getFishAddr()
Get the fishnet address of this node

Returns:
The fishnet address of this node

getIPAddress

public java.net.InetAddress getIPAddress()
Get the IP address of the machine that this emulated node is on

Returns:
The IP address of the machine that this emulated node is on

getPort

public int getPort()
Get the port that this emulated node is using to talk to its neighbors

Returns:
The port that this emulated node is using to talk to its neighbors

toString

public java.lang.String toString()
Return a string containing details of this emulated node

Overrides:
toString in class java.lang.Object
Returns:
A string containing details of this emulated node

isAlive

public boolean isAlive()
Check if the emulated node is still alive

Returns:
True if the node is still alive