true if the element is in the set, false if not.
+ */
public boolean contains(VertexInterface vertex) ;
-
+
+ /**
+ * Returns the HashSet which represents the ASet.
+ * @return A HashSet containing the same elements as in the set.
+ */
public HashSetVertexInterface in the graph.
+ * @return An integer giving the number of VertexInterface in the graph.
+ */
public int getVertexNumber() ;
- /** Return the cost between two vertexes **/
+ /**
+ * Gets the cost of the link (if it exists) between two vertexes.
+ * @param start
+ * The departure vertex.
+ * @param end
+ * The vertex from which we must see the cost of the link to start.
+ * @return An integer giving the cost of the link between the given VertexInterface.
+ */
public int getCost(VertexInterface start, VertexInterface end) ;
- /** Returns an list of Vertexes **/
+ /**
+ * Returns all VertexInterface contained in the graph.
+ * @return An ArrayList of VertexInterface.
+ */
public ArrayListVertexInterface.
+ * @param vertex
+ * The VertexInterface from which we will seek for neighbours.
+ * @return An ArrayList of VertexInterface.
+ */
public ArrayListVertexInterface
+ * @param vertex
+ * The VertexInterface from which we get the Pi value (cost) to reach it.
+ * @return An integer giving the Pi value (cost) the reach the VertexInterface.
+ *
+ */
public int getPi(VertexInterface vertex) ;
- /** Sets the Pi value of an element */
+ /**
+ * Sets the Pi value of an element
+ * @param i
+ * The Pi value (cost) to set.
+ * @param vertex
+ * The VertexInterface on which the Pi value (cost) is to be set.
+ */
public void setPi(int i, VertexInterface vertex) ;
}
diff --git a/src/dijkstra/Previous.java b/src/dijkstra/Previous.java
index b6acaeb..527b8af 100644
--- a/src/dijkstra/Previous.java
+++ b/src/dijkstra/Previous.java
@@ -2,9 +2,6 @@ package dijkstra;
import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.List;
-
-import maze.Box;
public class Previous implements PreviousInterface {
diff --git a/src/dijkstra/PreviousInterface.java b/src/dijkstra/PreviousInterface.java
index 02c08b9..c06dd6d 100644
--- a/src/dijkstra/PreviousInterface.java
+++ b/src/dijkstra/PreviousInterface.java
@@ -2,15 +2,36 @@ package dijkstra;
import java.util.ArrayList;
+/**
+ * The PreviousInterface contains information about the father (as in the graph's theory) of some VertexInterface.
+ * The father of a VertexInterface is the VertexInterface used to reach it.
+ * Typically in Dijkstra, it's the VertexInterface used to reach vertex with the lowest cost.
+ */
public interface PreviousInterface {
- /** Returns the father of an element */
+ /**
+ * Returns the father of a VertexInterface.
+ * @param vertex
+ * The VertexInterface from which we get the father (previous VertexInterface).
+ * @return The direct previous element used to reach vertex.
+ */
public VertexInterface getPrevious(VertexInterface vertex) ;
- /** Sets the father of an element to another element */
+ /**
+ * Sets the father of an element to another element.
+ * @param father
+ * The element that will become the father of the other element.
+ * @param son
+ * The element that will be assigned a new father.
+ */
public void setPrevious(VertexInterface father, VertexInterface son) ;
- /**Shortest path from root to a vertex */
+ /**
+ * Shortest path from root to a vertex.
+ * @param vertex
+ * The vertex to which the shortest path will be computed.
+ * @return An ArrayList of the VertexInterface used to reach vertex with the lowest cost.
+ */
public ArrayListVertexInterface to another.
+ * @param vertex
+ * The vertex to which the equality will be tested.
+ * @return true is the two VertexInterface are the same, false if not.
+ */
public boolean compareTo(VertexInterface vertex) ;
+ /**
+ * @return The label of the element.
+ */
public String getLabel() ;
}
diff --git a/src/maze/ABox.java b/src/maze/ABox.java
index 1b875d0..ef72aa2 100644
--- a/src/maze/ABox.java
+++ b/src/maze/ABox.java
@@ -1,5 +1,8 @@
package maze;
+/**
+ * ABox is an arrival Box. It's the last Box to be walked through and it's an exit to the Maze.
+ */
public class ABox extends Box{
public ABox (String label, int x, int y, Maze maze) {
diff --git a/src/maze/Box.java b/src/maze/Box.java
index 2326e21..9219de9 100644
--- a/src/maze/Box.java
+++ b/src/maze/Box.java
@@ -4,6 +4,18 @@ import java.util.List;
import dijkstra.VertexInterface;
+/** + * + * This class describes a Box and implements {@link dijkstra.VertexInterface}. + *
+ * A Box is represented with its coordinates, its label, and its neighbourList. It also has a reference on the Maze.
+ *
+ * @author Antonin Godard
+ * @author Sylvain Rager
+ *
+ */
+
public abstract class Box
implements VertexInterface {
diff --git a/src/maze/DBox.java b/src/maze/DBox.java
index 6bcdc8e..3b62e7c 100644
--- a/src/maze/DBox.java
+++ b/src/maze/DBox.java
@@ -1,5 +1,9 @@
package maze;
+/**
+ * A DBox is the Box on which the user is first in the Maze.
+ */
+
public class DBox extends Box{
public DBox (String label, int x, int y, Maze maze) {
diff --git a/src/maze/EBox.java b/src/maze/EBox.java
index 88c63d5..b2d968b 100644
--- a/src/maze/EBox.java
+++ b/src/maze/EBox.java
@@ -1,5 +1,9 @@
package maze;
+/**
+ * An EBox is a Box that can be walked through (an empty box).
+ */
+
public class EBox extends Box{
diff --git a/src/maze/Maze.java b/src/maze/Maze.java
index 93ce736..6d1c32a 100644
--- a/src/maze/Maze.java
+++ b/src/maze/Maze.java
@@ -8,6 +8,14 @@ import java.util.ArrayList;
import dijkstra.GraphInterface;
import dijkstra.VertexInterface;
+/**
+ * This class describes the maze as a matrix of Boxes ({@link maze.Box}). + * + * @author Antonin Godard + * @author Sylvain Rager + * + */ public class Maze implements GraphInterface { @@ -21,6 +29,9 @@ public class Maze } + /** + * + */ public int getCost(VertexInterface start, VertexInterface end) { Box startBox = (Box) start ; @@ -81,16 +92,20 @@ public class Maze } + /**Constructs the maze from a text file, according to each single character on each line. + * @param filename + * The path to the file containing the representation of the maze. + */ + public final void initFromTextFile(String filename) { FileReader fr = null ; BufferedReader br = null ; - try { //Determines the height of the maze and stores it into lineCount + try { fr = new FileReader(filename) ; br = new BufferedReader(fr) ; while (br.readLine() != null) dimensionY++; - //System.out.println("Line count :" + lineCount); } catch (Exception e) { e.printStackTrace(); } finally { diff --git a/src/maze/MazeReadingException.java b/src/maze/MazeReadingException.java index 0bfd24c..4cc5822 100644 --- a/src/maze/MazeReadingException.java +++ b/src/maze/MazeReadingException.java @@ -1,5 +1,12 @@ package maze; +/**
+ * This class is used to throw exception when reading and initiating the maze from a text file.
+ *
+ *
+ */
+
public class MazeReadingException
extends Exception {
diff --git a/src/maze/WBox.java b/src/maze/WBox.java
index d0adc4b..29a1107 100644
--- a/src/maze/WBox.java
+++ b/src/maze/WBox.java
@@ -1,5 +1,9 @@
package maze;
+/**
+ * A WBox is a Box that can't be walked through (a wall).
+ */
+
public class WBox extends Box {