cgl.narada.topology.viewer
Class Simulation

java.lang.Object
  extended by java.lang.Thread
      extended by cgl.narada.topology.viewer.Simulation
All Implemented Interfaces:
Runnable

public class Simulation
extends Thread

This class helps simulating the actual system where node addresses would come from some port.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 boolean addOrDelete
           
 List nodeArray
           
 Random numberGenerator1
           
 Random numberGenerator2
           
static String ssl
           
static String tcp
           
static String udp
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Simulation(NodeManagement nm, Screen sc)
          Only constructor that makes use of common NodeManagement and Screen objects (by TopologyViewer)
 
Method Summary
 void addLink()
          Randomly selects nodes (some logic is applied so that nodes in same super-super cluster are selected, to show high clustering) and insert a single link of one of the available types
 void addNode()
          Generates a random node address and invokes NodeManagement's method to add the nodes.
 void deleteLink()
          Deletes a existing link, for simplicity in this simulation all the existing links between pair are deleted.
 void deleteNode()
          From the stored local array of nodes, select one of the nodes for deletion and invokes NodeManagement's method.
 String getNode()
          Gets a node address from existing node array.
 void manageLinks()
          Depending upon the random number, either adds a link or deletes a link in the system.
 void manageNodes()
          Depending upon the random number, either adds a node or deletes a node in the system.
 void run()
          Overrides run() of the Thread class.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tcp

public static String tcp

udp

public static String udp

ssl

public static String ssl

nodeArray

public List nodeArray

numberGenerator1

public Random numberGenerator1

numberGenerator2

public Random numberGenerator2

addOrDelete

public boolean addOrDelete
Constructor Detail

Simulation

public Simulation(NodeManagement nm,
                  Screen sc)
Only constructor that makes use of common NodeManagement and Screen objects (by TopologyViewer)

Method Detail

run

public void run()
Overrides run() of the Thread class.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

manageNodes

public void manageNodes()
Depending upon the random number, either adds a node or deletes a node in the system.


manageLinks

public void manageLinks()
Depending upon the random number, either adds a link or deletes a link in the system.


addNode

public void addNode()
Generates a random node address and invokes NodeManagement's method to add the nodes. Also stores the node in local array required for simulation.


deleteNode

public void deleteNode()
From the stored local array of nodes, select one of the nodes for deletion and invokes NodeManagement's method.


addLink

public void addLink()
Randomly selects nodes (some logic is applied so that nodes in same super-super cluster are selected, to show high clustering) and insert a single link of one of the available types


deleteLink

public void deleteLink()
Deletes a existing link, for simplicity in this simulation all the existing links between pair are deleted.


getNode

public String getNode()
Gets a node address from existing node array.



For comments and suggestions please send e-mail to The NaradaBrokering Project