Merge the last Dijkstra classes #7

Merged
antograb merged 18 commits from lastDijsktraClasses into master 2017-12-10 16:51:59 +00:00
8 changed files with 18 additions and 20 deletions
Showing only changes of commit d46b3c3b99 - Show all commits

No files matched your search

+11 -3
View File
@@ -1,5 +1,7 @@
import dijkstra.Dijkstra;
import maze.Maze;
import java.util.ArrayList;
import dijkstra.*;
import maze.*;
public class MainTest {
@@ -7,7 +9,13 @@ public class MainTest {
Maze mazeTest = new Maze("data/labyrinthe.txt") ;
Dijkstra.dijkstra(mazeTest, mazeTest.getMaze()[1][1]) ;
Previous previous = (Previous) Dijkstra.dijkstra(mazeTest, mazeTest.getMaze()[1][1]);
ArrayList<VertexInterface> shortest = previous.getShortestPathTo(mazeTest.getMaze()[5][5]);
for (VertexInterface vertex : shortest) {
System.out.println(vertex);
}
mazeTest.saveToTextFile("data/labyOutput.txt");
-2
View File
@@ -2,8 +2,6 @@ package dijkstra;
import java.util.HashSet;
import maze.Box;
public class ASet implements ASetInterface {
private HashSet<VertexInterface> vertexHashSet = new HashSet<VertexInterface>() ;
-6
View File
@@ -2,17 +2,12 @@ package dijkstra;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import maze.Box;
public class Previous implements PreviousInterface {
private Hashtable<VertexInterface, VertexInterface> hashPrevious = new Hashtable<VertexInterface, VertexInterface>() ;
private ArrayList<VertexInterface> shortestPath = new ArrayList<VertexInterface>() ;
public Previous(Hashtable<VertexInterface, VertexInterface> hashPrevious, ArrayList<VertexInterface> shortestPath) {
this.hashPrevious = new Hashtable<VertexInterface, VertexInterface>(hashPrevious);
@@ -40,7 +35,6 @@ public class Previous implements PreviousInterface {
else {
return getShortestPathTo(father) ;
}
}
}
-1
View File
@@ -1,5 +1,4 @@
package dijkstra;
import java.util.List;
public interface VertexInterface {
+1 -1
View File
@@ -1,6 +1,6 @@
package maze;
public class ABox extends Box{
public class ABox extends EBox{
public ABox (String label, int x, int y, Maze maze) {
+4 -4
View File
@@ -21,7 +21,7 @@ public abstract class Box
}
public List<VertexInterface> generateNeighbors() {
public ArrayList<VertexInterface> generateNeighbors() {
return maze.generateNeighbours(this) ;
}
@@ -45,11 +45,11 @@ public abstract class Box
return false ;
}
public List<Box> getNeighbourList() {
public ArrayList<Box> getNeighbourList() {
return neighbourList;
}
public void setNeighbourList(List<Box> neighbourList) {
public void setNeighbourList(ArrayList<Box> neighbourList) {
this.neighbourList = neighbourList;
}
@@ -86,7 +86,7 @@ public abstract class Box
}
public String toString() {
return label;
return "Label: " + label + ", x: " + x + ", y: " + y;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
package maze;
public class DBox extends Box{
public class DBox extends EBox{
public DBox (String label, int x, int y, Maze maze) {
+1 -2
View File
@@ -3,12 +3,11 @@ package maze;
public class MazeReadingException
extends Exception {
private String filename ;
private static final long serialVersionUID = 1L;
public MazeReadingException (String filename) {
super("Invalid maze format : " + filename) ;
this.filename = filename ;
}