[WIP] Useless code removal and code cleanup #5

Manually merged
regar42 merged 5 commits from fixUnneededCode into lastDijsktraClasses 2017-12-10 16:48:34 +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 java.util.ArrayList;
import maze.Maze;
import dijkstra.*;
import maze.*;
public class MainTest { public class MainTest {
@@ -7,7 +9,13 @@ public class MainTest {
Maze mazeTest = new Maze("data/labyrinthe.txt") ; 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"); mazeTest.saveToTextFile("data/labyOutput.txt");
-2
View File
@@ -2,8 +2,6 @@ package dijkstra;
import java.util.HashSet; import java.util.HashSet;
import maze.Box;
public class ASet implements ASetInterface { public class ASet implements ASetInterface {
private HashSet<VertexInterface> vertexHashSet = new HashSet<VertexInterface>() ; private HashSet<VertexInterface> vertexHashSet = new HashSet<VertexInterface>() ;
-6
View File
@@ -2,17 +2,12 @@ package dijkstra;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List;
import maze.Box;
public class Previous implements PreviousInterface { public class Previous implements PreviousInterface {
private Hashtable<VertexInterface, VertexInterface> hashPrevious = new Hashtable<VertexInterface, VertexInterface>() ; private Hashtable<VertexInterface, VertexInterface> hashPrevious = new Hashtable<VertexInterface, VertexInterface>() ;
private ArrayList<VertexInterface> shortestPath = new ArrayList<VertexInterface>() ; private ArrayList<VertexInterface> shortestPath = new ArrayList<VertexInterface>() ;
public Previous(Hashtable<VertexInterface, VertexInterface> hashPrevious, ArrayList<VertexInterface> shortestPath) { public Previous(Hashtable<VertexInterface, VertexInterface> hashPrevious, ArrayList<VertexInterface> shortestPath) {
this.hashPrevious = new Hashtable<VertexInterface, VertexInterface>(hashPrevious); this.hashPrevious = new Hashtable<VertexInterface, VertexInterface>(hashPrevious);
@@ -40,7 +35,6 @@ public class Previous implements PreviousInterface {
else { else {
return getShortestPathTo(father) ; return getShortestPathTo(father) ;
} }
} }
} }
-1
View File
@@ -1,5 +1,4 @@
package dijkstra; package dijkstra;
import java.util.List;
public interface VertexInterface { public interface VertexInterface {
+1 -1
View File
@@ -1,6 +1,6 @@
package maze; package maze;
public class ABox extends Box{ public class ABox extends EBox{
public ABox (String label, int x, int y, Maze maze) { 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) ; return maze.generateNeighbours(this) ;
} }
@@ -45,11 +45,11 @@ public abstract class Box
return false ; return false ;
} }
public List<Box> getNeighbourList() { public ArrayList<Box> getNeighbourList() {
return neighbourList; return neighbourList;
} }
public void setNeighbourList(List<Box> neighbourList) { public void setNeighbourList(ArrayList<Box> neighbourList) {
this.neighbourList = neighbourList; this.neighbourList = neighbourList;
} }
@@ -86,7 +86,7 @@ public abstract class Box
} }
public String toString() { public String toString() {
return label; return "Label: " + label + ", x: " + x + ", y: " + y;
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
package maze; package maze;
public class DBox extends Box{ public class DBox extends EBox{
public DBox (String label, int x, int y, Maze maze) { public DBox (String label, int x, int y, Maze maze) {
+1 -2
View File
@@ -3,12 +3,11 @@ package maze;
public class MazeReadingException public class MazeReadingException
extends Exception { extends Exception {
private String filename ; private static final long serialVersionUID = 1L;
public MazeReadingException (String filename) { public MazeReadingException (String filename) {
super("Invalid maze format : " + filename) ; super("Invalid maze format : " + filename) ;
this.filename = filename ;
} }