|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMazeSolver
public class MazeSolver
Field Summary | |
---|---|
(package private) java.io.File |
file
|
(package private) int |
height
|
(package private) Maze |
maze
|
(package private) java.util.Stack<Vertex> |
path
|
(package private) java.util.Scanner |
scan
|
(package private) int |
width
|
Constructor Summary | |
---|---|
MazeSolver(java.io.File file)
Constructor initializes width, height, scanner, and maze. |
|
MazeSolver(Maze maze)
Given a maze, calls solveMaze() |
Method Summary | |
---|---|
void |
fillMaze()
Reads in pairs of vertices from the file (passed into scan in the constructor) to build up the maze. |
Maze |
getMaze()
|
static void |
printPath(java.util.Stack<Vertex> stack)
The stack contains the path in reverse order, so pop into another stack, then pop and print. |
void |
solveMaze()
Find and print the shortest path |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
int width
int height
Maze maze
java.util.Stack<Vertex> path
java.io.File file
java.util.Scanner scan
Constructor Detail |
---|
public MazeSolver(java.io.File file) throws java.io.FileNotFoundException
file
- The file to scan from
java.io.FileNotFoundException
public MazeSolver(Maze maze)
maze
- The maze to be solvedMethod Detail |
---|
public void fillMaze()
public Maze getMaze()
public void solveMaze()
public static void printPath(java.util.Stack<Vertex> stack)
stack
- The vertices of the path
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |