Graph
Class Node

java.lang.Object
  |
  +--Graph.Node

public final class Node
extends java.lang.Object

The Node class for our Graph contains only the base minimum member variables. Environment specific semantics (such as Router or AS etc) that are often attached to a node are divorced from the Node class and stored in a decorator class, NodeConf (short for NodeConfiguration). As such you can add/remove attributes to the Node at run-time without having to change the Node representation.

We use the decorator pattern as the relationship between a Node and its configuration, NodeConf. This pattern is described in Design Patterns: Elements of Reusable Object-Oriented Software by Gamma et al. ISBN#: 0-201-63361-2.

Unique NodeIDs (used in Graph) are computed by maintaining a static variable that is incremented each time a new nodes is created.


Field Summary
static Graph.NodeIDComparator IDcomparator
          provides a comparator to sort nodes by their IDs
 
Constructor Summary
Node()
          Class Constructor1.
Node(int inDeg, int outDeg)
          Constructor2: same as Constructor 1 but allows convenience of specifying indegree and outdegree of the nodes.
 
Method Summary
 int getAddr()
           
 int getColor()
           
 int getID()
           
 int getInDegree()
           
 NodeConf getNodeConf()
           
static int getNodeCount()
           
 int getOutDegree()
           
static int getUniqueID()
           
 void incrementInDegree()
           
 void incrementOutDegree()
           
 void setAddr(int addr)
           
 void setColor(int c)
           
 void setID(int id)
           
 void setInDegree(int indegree)
           
 void setNodeConf(NodeConf n)
           
 void setOutDegree(int outdegree)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDcomparator

public static Graph.NodeIDComparator IDcomparator
provides a comparator to sort nodes by their IDs
Constructor Detail

Node

public Node()
Class Constructor1. Assigns the node a unique ID (maintained by a static var) and does other initialization.

Node

public Node(int inDeg,
            int outDeg)
Constructor2: same as Constructor 1 but allows convenience of specifying indegree and outdegree of the nodes. Useful when importing other topologies.
Method Detail

getID

public int getID()

getAddr

public int getAddr()

getInDegree

public int getInDegree()

getOutDegree

public int getOutDegree()

getColor

public int getColor()

getNodeConf

public NodeConf getNodeConf()

getNodeCount

public static int getNodeCount()

getUniqueID

public static int getUniqueID()

setID

public void setID(int id)

setAddr

public void setAddr(int addr)

setInDegree

public void setInDegree(int indegree)

setOutDegree

public void setOutDegree(int outdegree)

setColor

public void setColor(int c)

setNodeConf

public void setNodeConf(NodeConf n)

incrementInDegree

public void incrementInDegree()

incrementOutDegree

public void incrementOutDegree()