net.spy.util
Class ShortestPath<N extends SPNode<N>>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<N>
net.spy.util.ShortestPath<N>
- All Implemented Interfaces:
- Serializable, Cloneable, Iterable<N>, Collection<N>, List<N>, RandomAccess
public class ShortestPath<N extends SPNode<N>>
- extends ArrayList<N>
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
|
Constructor Summary |
ShortestPath(N from,
N to)
Get an instance of ShortestPath. |
|
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, remove, removeRange, set, size, toArray, toArray, trimToSize |
ShortestPath
public ShortestPath(N from,
N 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.
Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.