cgl.narada.topology.viewer
Class LinkManagement

java.lang.Object
  extended by cgl.narada.topology.viewer.LinkManagement

public class LinkManagement
extends Object

This class managed all the links present in the system.


Field Summary
 List links
           
 
Constructor Summary
LinkManagement()
          Only constructor.
 
Method Summary
 void addLink(Node n1, Node n2, int linkId, String linkType)
          Adds a link between the specified node pair.
 void deleteAllLinks()
           
 void deleteAllLinksForNode(Node n)
          Deletes all the links emerging from the specified node.
 void deleteLink(Node n1, Node n2, int linkId)
          Deletes a particular link between two nodes.
 void deleteLinksForPair(Node n1, Node n2)
           
 void drawAllLinks(Graphics g)
          Draws all the links present in the system.
 List getAllLinksForNode(Node n)
          Returns all the links emerging from a particular node.
 List getAllLinksForPair(Node n1, Node n2)
          Returns all the links between a given node pair.
 Color getLinkColor(Node n1, Node n2)
          Gets one of the four colors depending upon the end nodes of a link
 int getLinkCount()
          Returns total number of links present in the system.
 LinkDetails getLinkDetails(Node n1, Node n2)
          Get object containing information about all the links between specified node pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

links

public List links
Constructor Detail

LinkManagement

public LinkManagement()
Only constructor. Initialises link count.

Method Detail

addLink

public void addLink(Node n1,
                    Node n2,
                    int linkId,
                    String linkType)
Adds a link between the specified node pair. Increments the linkCount.

Parameters:
n1 - one end Noed of a link.
n2 - other end node of a link.
linkId - id of a link to be inserted.
linkType - type of a link to be inserted.

deleteLink

public void deleteLink(Node n1,
                       Node n2,
                       int linkId)
                throws TopologyException
Deletes a particular link between two nodes.

Parameters:
n1 - one end Noed of a link.
n2 - other end node of a link.
linkId - id of the link to be deleted.
Throws:
TopologyException - if specified node pair is not found.

deleteAllLinksForNode

public void deleteAllLinksForNode(Node n)
Deletes all the links emerging from the specified node.

Parameters:
n - Node whose connections are being removed.

deleteLinksForPair

public void deleteLinksForPair(Node n1,
                               Node n2)

deleteAllLinks

public void deleteAllLinks()

getLinkCount

public int getLinkCount()
Returns total number of links present in the system.

Returns:
linkCount total link count.

getAllLinksForNode

public List getAllLinksForNode(Node n)
Returns all the links emerging from a particular node.

Parameters:
n - Node of which connections are being returned.
Returns:
List of all the links emerging from specified node.

getAllLinksForPair

public List getAllLinksForPair(Node n1,
                               Node n2)
Returns all the links between a given node pair.

Parameters:
n1 - one Node of a pair.
n2 - other Node of a pair.
Returns:
List containing String representations of all the links between specified pair.

getLinkDetails

public LinkDetails getLinkDetails(Node n1,
                                  Node n2)
Get object containing information about all the links between specified node pair.

Parameters:
n1 - one end Node of a link.
n2 - other end Node of a link.
Returns:
LinkDetails object for a specified node pair.

drawAllLinks

public void drawAllLinks(Graphics g)
Draws all the links present in the system.

Parameters:
g - Graphics object pertaining to the image being drawn.

getLinkColor

public Color getLinkColor(Node n1,
                          Node n2)
Gets one of the four colors depending upon the end nodes of a link

Parameters:
n1 - one end Node of a link.
n2 - other end Node of a link.
Returns:
Color object for the link between specified node pair.


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