cgl.narada.protocol
Class Path

java.lang.Object
  extended by cgl.narada.protocol.Path

public class Path
extends Object

In any complete recursive call, for calculation of the shortest path to reach given node in the connectivity graph we do not wish to get into an infinite loop, the path keeps track of all the nodes that have been visited during recursion to ensure that the same hop isn't taken twice. This is especially important in the case of cyclic connectivities like (a)->(b)->(c)->(a)


Constructor Summary
Path()
           
 
Method Summary
 void addCost(short _cost)
          This allows us to update the cost associated with a path.
 void addHop(Gateway gateway)
          Updates the path, to reflect the node which was traversed during the recursion for calculation of shortest paths to a gateway
 Path createCopy()
          Serves the same function that a copy constructor in C++ does.
 Gateway getBestHopToTakeToReachNode()
          This method returns the best hop to take to reach the vertex node
 short getCost()
          This gets the cost associated with any path.
 Gateway[] getHopsTraversed()
          Provides a list of the nodes in the connectivity graph that were visited
 boolean nodeTraversed(Gateway gateway)
          Check to see if a node was visited by one of the forks of a recursion process.
 void updatePath(Path path)
          Paths also maintain a cache of their shortest path to the vertex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Path

public Path()
Method Detail

createCopy

public Path createCopy()
Serves the same function that a copy constructor in C++ does. For the Path object we need to at times pass the path by value instead of the Java default of pass by reference. This serves that purpose.

Returns:
A copy of the path on which this method was invoked. The hops and the costs associated with traversal are copied too

getCost

public short getCost()
This gets the cost associated with any path. The cost for traversal over an edge in the connectivity graph is dictated by the link cost matrix. A path represents a series of edges that were traversed in the connectivity graph.

Returns:
The cost associated with a path.

addCost

public void addCost(short _cost)
This allows us to update the cost associated with a path.

Parameters:
_cost - - Increments the cost of the path by the specified value.

addHop

public void addHop(Gateway gateway)
Updates the path, to reflect the node which was traversed during the recursion for calculation of shortest paths to a gateway

Parameters:
gateway - - The node in the connectivity graph that was traversed.

nodeTraversed

public boolean nodeTraversed(Gateway gateway)
Check to see if a node was visited by one of the forks of a recursion process.

Returns:
- true If the node was traversed, false otherwise.

getHopsTraversed

public Gateway[] getHopsTraversed()
Provides a list of the nodes in the connectivity graph that were visited

Returns:
- The nodes that were visted, as an array.

updatePath

public void updatePath(Path path)
Paths also maintain a cache of their shortest path to the vertex. This allows a recursion to make use of an already computed path to arrive at its decision for the best path.

Parameters:
path - - The shortest path from a node to some other gateway. This path was computed during an earlier recursion process

getBestHopToTakeToReachNode

public Gateway getBestHopToTakeToReachNode()
This method returns the best hop to take to reach the vertex node



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