|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcgl.narada.protocol.Path
public class Path
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 |
|---|
public Path()
| Method Detail |
|---|
public Path createCopy()
public short getCost()
public void addCost(short _cost)
_cost - - Increments the cost of the path by the specified value.public void addHop(Gateway gateway)
gateway - - The node in the connectivity graph that was traversed.public boolean nodeTraversed(Gateway gateway)
public Gateway[] getHopsTraversed()
public void updatePath(Path path)
path - - The shortest path from a node to some other gateway. This
path was computed during an earlier recursion processpublic Gateway getBestHopToTakeToReachNode()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||