[WIP] Add javadoc for most classes. #6

Manually merged
regar42 merged 5 commits from javadoc into lastDijsktraClasses 2017-12-10 14:40:43 +00:00
15 changed files with 157 additions and 20 deletions

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
*.html
*.css
src/package-list
src/script.js
+19 -2
View File
@@ -2,14 +2,31 @@ package dijkstra;
import java.util.HashSet;
/**
* This is the ASet class as described in the INF101 course of Telecom Paristech.
* The ASet contains vertexes for which the shortest path has already been found (vertexes already examined by the dijkstra algorithm).
*/
public interface ASetInterface {
/** Add a vertex to the ASet */
/**
* Adds a vertex to the set.
* @param vertex
* The element to be added to the set.
*/
public void add(VertexInterface vertex) ;
/** Check if a vertex belongs to ASet */
/**
* Checks if a vertex belongs to the set.
* @param vertex
* The element we must check if it belongs to the set.
* @return <code>true</code> if the element is in the set, <code>false</code> if not.
*/
public boolean contains(VertexInterface vertex) ;
/**
* Returns the HashSet which represents the ASet.
* @return A <code>HashSet</code> containing the same elements as in the set.
*/
public HashSet<VertexInterface> getVertexHashSet();
+2 -2
View File
@@ -26,7 +26,7 @@ public class Dijkstra {
if (!a.contains(vertex)) {
if (pi.getPi(pivot) + g.getCost(pivot, vertex) < pi.getPi(vertex)) {
pi.setPi(pi.getPi(pivot) + g.getCost(pivot, vertex), vertex) ;
previous.setPrevious(pivot, vertex);
previous.setPrevious(pivot, vertex) ;
}
}
}
@@ -38,7 +38,7 @@ public class Dijkstra {
piMax = pi.getPi(vertex) ;
}
}
a.add(pivot);
a.add(pivot) ;
}
return previous ;
+26 -4
View File
@@ -1,18 +1,40 @@
package dijkstra;
import java.util.ArrayList;
/**
* This is the Graph class as described in the INF101 course of Telecom Paristech.
* Graph contains the representation of all the vertexes, with the information on which vertex(es) a vertex is linked to and at what cost.
*/
public interface GraphInterface {
/** Returns the number of Vertexes **/
/**
* Gets the number of <code>VertexInterface</code> in the graph.
* @return An integer giving the number of <code>VertexInterface</code> 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 <code>start</code>.
* @return An integer giving the cost of the link between the given <code>VertexInterface</code>.
*/
public int getCost(VertexInterface start, VertexInterface end) ;
/** Returns an list of Vertexes **/
/**
* Returns all <code>VertexInterface</code> contained in the graph.
* @return An <code>ArrayList</code> of <code>VertexInterface</code>.
*/
public ArrayList<VertexInterface> getVertexes() ;
/** Returns the neighbour list for a given box */
/**
* Returns the neighbour list for a given <code>VertexInterface</code>.
* @param vertex
* The <code>VertexInterface</code> from which we will seek for neighbours.
* @return An <code>ArrayList</code> of <code>VertexInterface</code>.
*/
public ArrayList<VertexInterface> generateNeighbours(VertexInterface vertex) ;
}
+18 -2
View File
@@ -1,11 +1,27 @@
package dijkstra;
/**
* This is the Pi class as described in the INF101 course of Telecom Paristech.
* It contains the path's cost to reach vertexes (typically, from the root of the graph).
*/
public interface PiInterface {
/** Returns the value of pi(v) */
/**
* Gets the cost to reach the given <code>VertexInterface</code>
* @param vertex
* The <code>VertexInterface</code> from which we get the Pi value (cost) to reach it.
* @return An <code>integer</code> giving the Pi value (cost) the reach the <code>VertexInterface</code>.
*
*/
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 <code>VertexInterface</code> on which the Pi value (cost) is to be set.
*/
public void setPi(int i, VertexInterface vertex) ;
}
-3
View File
@@ -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 {
+24 -3
View File
@@ -2,15 +2,36 @@ package dijkstra;
import java.util.ArrayList;
/**
* The <code>PreviousInterface</code> contains information about the father (as in the graph's theory) of some <code>VertexInterface</code>.
* The father of a <code>VertexInterface</code> is the <code>VertexInterface</code> used to reach it.
* Typically in Dijkstra, it's the <code>VertexInterface</code> used to reach <code>vertex</code> with the lowest cost.
*/
public interface PreviousInterface {
/** Returns the father of an element */
/**
* Returns the father of a <code>VertexInterface</code>.
* @param vertex
* The <code>VertexInterface</code> from which we get the father (previous <code>VertexInterface</code>).
* @return The direct previous element used to reach <code>vertex</code>.
*/
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 <code>ArrayList</code> of the <code>VertexInterface</code> used to reach vertex with the lowest cost.
*/
public ArrayList<VertexInterface> getShortestPathTo(VertexInterface vertex) ;
}
+13 -2
View File
@@ -1,10 +1,21 @@
package dijkstra;
import java.util.List;
/**
* This describes a vertex as seen in graphs (see INF101 course).
*
*/
public interface VertexInterface {
/** Compare a Vertex to another */
/**
* Compares a <code>VertexInterface</code> to another.
* @param vertex
* The vertex to which the equality will be tested.
* @return <code>true</code> is the two <code>VertexInterface</code> are the same, <code>false</code> if not.
*/
public boolean compareTo(VertexInterface vertex) ;
/**
* @return The label of the element.
*/
public String getLabel() ;
}
+3
View File
@@ -1,5 +1,8 @@
package maze;
/**
* <code>ABox</code> is an arrival <code>Box</code>. It's the last <code>Box</code> to be walked through and it's an exit to the <code>Maze</code>.
*/
public class ABox extends Box{
public ABox (String label, int x, int y, Maze maze) {
+12
View File
@@ -4,6 +4,18 @@ import java.util.List;
import dijkstra.VertexInterface;
/** <h1> Box class </h1>
* <p>
*
* This class describes a Box and implements {@link dijkstra.VertexInterface}.
* <p>
* 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 {
+4
View File
@@ -1,5 +1,9 @@
package maze;
/**
* A <code>DBox</code> is the <code>Box</code> on which the user is first in the <code>Maze</code>.
*/
public class DBox extends Box{
public DBox (String label, int x, int y, Maze maze) {
+4
View File
@@ -1,5 +1,9 @@
package maze;
/**
* An <code>EBox</code> is a <code>Box</code> that can be walked through (an empty box).
*/
public class EBox extends Box{
+17 -2
View File
@@ -8,6 +8,14 @@ import java.util.ArrayList;
import dijkstra.GraphInterface;
import dijkstra.VertexInterface;
/** <h1> Maze class </h1>
* <p>
* 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 {
+7
View File
@@ -1,5 +1,12 @@
package maze;
/**<h1> MazeReadingException exception </h1>
* <p>
* This class is used to throw exception when reading and initiating the maze from a text file.
*
*
*/
public class MazeReadingException
extends Exception {
+4
View File
@@ -1,5 +1,9 @@
package maze;
/**
* A <code>WBox</code> is a <code>Box</code> that can't be walked through (a wall).
*/
public class WBox extends Box {