core
Class NodeManager

java.lang.Object
  extended bycore.NodeManager

public class NodeManager
extends java.lang.Object

NodeManager.java - Centralised repository for information on nodes in the simulation

Author:
Avi TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Method Summary
 void addNode(int x, int y, java.lang.String IPAddress, java.awt.Color c)
          Add a Node to the NodeManager
 void editVNodeIP(java.lang.String IPold, java.lang.String IPnew)
          Change the IPAddress of a node.
 void editVNodex(java.lang.String IP, java.lang.String stringx)
          Change the x co-ordinate of a node
 void editVNodey(java.lang.String IP, java.lang.String stringy)
          Change the y co-ordinate of a node
 VisualNode findNode(java.lang.String IP)
          Returns a VisualNode with the desired IP Address
 java.util.ArrayList getNodes()
          Return the list of nodes currently contained in the node manager.
 boolean inRange(java.lang.String srcIP, java.lang.String destIP, double dist)
          Check if two nodes are within range of each other.
static NodeManager instance()
           
 void moveNodes()
          Move the positions of the nodes contained in the NodeManager.
 void nodestep()
          Step(change) the x and y co-ordinates of the nodes in the NodeManager.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static NodeManager instance()
Returns:
The unique instance of this class.

addNode

public void addNode(int x,
                    int y,
                    java.lang.String IPAddress,
                    java.awt.Color c)
Add a Node to the NodeManager

Parameters:
x - Initial x position
y - Initial y position
IPAddress - The IP Address of the node
c - The Color object of the node

getNodes

public java.util.ArrayList getNodes()
Return the list of nodes currently contained in the node manager.

Returns:
ArrayList containing VisualNode objects.

moveNodes

public void moveNodes()
Move the positions of the nodes contained in the NodeManager. NEED TO IMPLEMENT A MOBILITY MODEL INTERFACE.


inRange

public boolean inRange(java.lang.String srcIP,
                       java.lang.String destIP,
                       double dist)
Check if two nodes are within range of each other.

Parameters:
srcIP - IP Address of source node.
destIP - IP Address of destination node
dist - Range distance
Returns:
Returns true if the two nodes are in range, false otherwise

editVNodeIP

public void editVNodeIP(java.lang.String IPold,
                        java.lang.String IPnew)
Change the IPAddress of a node.

Parameters:
IPold - Old IP
IPnew -

editVNodex

public void editVNodex(java.lang.String IP,
                       java.lang.String stringx)
Change the x co-ordinate of a node

Parameters:
IP - IP Address of the node to be changed
stringx - x co-ordinate as a String

editVNodey

public void editVNodey(java.lang.String IP,
                       java.lang.String stringy)
Change the y co-ordinate of a node

Parameters:
IP - IP Address of the node to be changed
stringy - y co-ordinate as a String

findNode

public VisualNode findNode(java.lang.String IP)
Returns a VisualNode with the desired IP Address

Parameters:
IP - IP Address to be searched for.
Returns:
VisualNode object with the desried IP Address.

nodestep

public void nodestep()
Step(change) the x and y co-ordinates of the nodes in the NodeManager.