net.spy.util
Class ShortestPath
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
net.spy.util.ShortestPath
- All Implemented Interfaces:
- Cloneable, Collection, List, RandomAccess, Serializable
- public class ShortestPath
- extends ArrayList
Represents the shortest path between two SPNodes. This class can be used
to find and store the shortest path between two SPNode
instances.
- See Also:
ShortestPathFinder,
Serialized Form
|
Method Summary |
int |
getCost()
Get the cost of this path. |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
ShortestPath
public ShortestPath(SPNode from,
SPNode to)
throws NoPathException
- Get an instance of ShortestPath.
- Parameters:
from - the starting nodeto - the ending node
- Throws:
NoPathException - if there's no path to the destination
NullPointerException - if from or to is null
getCost
public int getCost()
- Get the cost of this path.