Class Topology

java.lang.Object
  extended by Topology

public class Topology
extends java.lang.Object

 Topology class keeps track of connections between nodes.
 This is a Singleton object
 


Method Summary
 boolean failEdge(int a, int b)
          Mark the given edge as failed so that we don't use it
 void failNode(int a)
          Mark the given node as failed, so that we don't use any edge that goes through it
static Topology GetInstance()
          Static method for getting an instance of Topology
static Topology GetInstance(boolean allToAll)
          Static method for getting an instance of Topology
 Edge getLiveEdge(int a, int b)
          Returns the edge between a and b, if one exists and it is live.
 boolean isNodeAlive(int node)
          Returns true if the given node is alive, else return false
 void newEdge(int a, int b, EdgeOptions options)
          Creates a new edge or updates an existing one
 boolean restartEdge(int a, int b)
          Restart the given edge so that we can use it again
 void restartNode(int a)
          Mark the given node as ok, so that we can use it again
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

GetInstance

public static Topology GetInstance()
Static method for getting an instance of Topology

Returns:
An instance of Topology

GetInstance

public static Topology GetInstance(boolean allToAll)
Static method for getting an instance of Topology

Returns:
An instance of Topology

getLiveEdge

public Edge getLiveEdge(int a,
                        int b)
Returns the edge between a and b, if one exists and it is live. Returns null otherwise

Parameters:
a - Int specifying a node
b - Int specifying a node
Returns:
The live edge between a and b. If one does not exist then null is returned

isNodeAlive

public boolean isNodeAlive(int node)
Returns true if the given node is alive, else return false

Parameters:
node - Int specifying node

newEdge

public void newEdge(int a,
                    int b,
                    EdgeOptions options)
Creates a new edge or updates an existing one

Parameters:
a - Int specifying a node
b - Int specifying a node
options - Options to set for the given edge

failEdge

public boolean failEdge(int a,
                        int b)
Mark the given edge as failed so that we don't use it

Parameters:
a - Int specifying a node
b - Int specifying a node
Returns:
True if edge was succesfully failed. False if no edge exists between a and b

restartEdge

public boolean restartEdge(int a,
                           int b)
Restart the given edge so that we can use it again

Parameters:
a - Int specifying a node
b - Int specifying a node
Returns:
True if edge was succesfully restarted. False if no edge exists between a and b

failNode

public void failNode(int a)
Mark the given node as failed, so that we don't use any edge that goes through it

Parameters:
a - Int specifying a node

restartNode

public void restartNode(int a)
Mark the given node as ok, so that we can use it again

Parameters:
a - Int specifying a node