[WIP] Add javadoc for most classes. #6
No files matched your search
@@ -4,16 +4,29 @@ 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. */
|
||||
/**
|
||||
* Returns the HashSet which represents the ASet.
|
||||
* @return A <code>HashSet</code> containing the same elements as in the set.
|
||||
*/
|
||||
public HashSet<VertexInterface> getVertexHashSet();
|
||||
|
||||
|
||||
|
||||
@@ -3,20 +3,38 @@ 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) ;
|
||||
|
||||
}
|
||||
@@ -2,14 +2,26 @@ 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) ;
|
||||
|
||||
}
|
||||
@@ -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) ;
|
||||
|
||||
}
|
||||
@@ -6,9 +6,16 @@ package dijkstra;
|
||||
*/
|
||||
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) ;
|
||||
|
||||
/** Returns the Label of the vertex. */
|
||||
/**
|
||||
* @return The label of the element.
|
||||
*/
|
||||
public String getLabel() ;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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{
|
||||
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ 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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user