import java.util.Iterator; /** * A path is a sequence of nodes describing how to get from one * node to another in a graph. A node is represented by its name (i.e. a String). * A node cannot occur more than once in a single path. * The path is initialized by a call to computePath() after which the * relevant information can be retrieved using the methods getPath() and * getPathLength(). */ public interface Path { /** * Computes the path from from to to. * Path information can be retrieved by subsequent calls * to getPath() and getPathLength(). * This method can be called multiple times with different nodes. */ public void computePath (String from, String to); /** * Return an iterator over (the names of) the nodes in the path. * If a path has been found the first node in the iterator is the argument * from passed to computePath and the last node is to. * If no path was found or if no call to computePath has been made * the iterator is empty. * @return An iterator over the computed path. */ public Iterator getPath (); /** * Return the length of the computed path. If no path was found or no call * has been made to computePath() the return value is undefined, otherwise * the return value is the length of the computed path. * @return The length of the computed path. */ public int getPathLength (); }