ninja.activeproxy.path.pxset
Class Graph

java.lang.Object
  |
  +--ninja.activeproxy.path.pxset.Graph

class Graph
extends java.lang.Object


Field Summary
(package private)  java.util.Hashtable adjMatrix
           
 
Constructor Summary
Graph()
          Constructor: Creates empty hashtable
 
Method Summary
 void addLink(java.lang.String uniqueID1, java.lang.String uniqueID2)
          Method to add a link FROM node uniqueID1 TO node uniqueID2
 void addNode(java.lang.String uniqueID)
          Method to add node to the graph
private  int[] connected_nodes(java.util.Vector nodes, int index)
          returns array of neighbors
 boolean containsNode(java.lang.String uniqueID)
          Method to find out if a node is already there in the Graph will be implemented only if a hash table is used
 java.util.Vector createPath(java.lang.String uniqueID1, java.lang.String uniqueID2)
          Method to get the path between two nodes The path returned INCLUDES BOTH Node uniqueID1 AND NODE uniqueID2 The path is FROM Node uniqueID1 TO uniqueID2 In case source and dest are the same return a size1 vector
 Node getNode(java.lang.String uniqueID)
          Method to retrieve node from the graph
 void removeLink(java.lang.String uniqueID1, java.lang.String uniqueID2)
          Method to delete a link FROM node uniqueID1 TO node uniqueID2
 void removeNode(java.lang.String uniqueID)
          Method to remove node the graph
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

adjMatrix

java.util.Hashtable adjMatrix
Constructor Detail

Graph

public Graph()
Constructor: Creates empty hashtable
Method Detail

containsNode

public boolean containsNode(java.lang.String uniqueID)
Method to find out if a node is already there in the Graph will be implemented only if a hash table is used
Parameters:
uniqueID - unique id of the node
Returns:
true/false

addNode

public void addNode(java.lang.String uniqueID)
             throws DuplicateException
Method to add node to the graph
Parameters:
uniqueID - unique ID of the node

removeNode

public void removeNode(java.lang.String uniqueID)
                throws NotFoundException
Method to remove node the graph
Parameters:
uniqueID - unique id of the node

getNode

public Node getNode(java.lang.String uniqueID)
             throws NotFoundException
Method to retrieve node from the graph
Parameters:
uniqueID - unique id of the node
Returns:
Node object

addLink

public void addLink(java.lang.String uniqueID1,
                    java.lang.String uniqueID2)
             throws NotFoundException,
                    DuplicateException
Method to add a link FROM node uniqueID1 TO node uniqueID2
Parameters:
uniqueID1 - the FROM node
uniqueID2 - the TO node
Throws:
NotFoundException - if either does not exist
DuplicateException - if already linked

removeLink

public void removeLink(java.lang.String uniqueID1,
                       java.lang.String uniqueID2)
                throws NotFoundException
Method to delete a link FROM node uniqueID1 TO node uniqueID2
Parameters:
uniqueID1 - the FROM node
uniqueID2 - the TO node
Throws:
NotFoundException - if not neighbors

createPath

public java.util.Vector createPath(java.lang.String uniqueID1,
                                   java.lang.String uniqueID2)
                            throws PathCreationNotPossibleException,
                                   NotFoundException
Method to get the path between two nodes The path returned INCLUDES BOTH Node uniqueID1 AND NODE uniqueID2 The path is FROM Node uniqueID1 TO uniqueID2 In case source and dest are the same return a size1 vector
Parameters:
uniqueID1 - the FROM node
uniqueID2 - the TO node
Returns:
names of nodes inbetween
Throws:
PathCreationNotPossibleException -  

connected_nodes

private int[] connected_nodes(java.util.Vector nodes,
                              int index)
                       throws NotFoundException
returns array of neighbors
Parameters:
nodes - nodes in the graph
Throws:
NotFoundException - if node does not exist