[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
Showing only changes of commit eb1e7a8bc0 - Show all commits
+6 -11
View File
@@ -26,16 +26,7 @@ public class Maze
Box startBox = (Box) start ; Box startBox = (Box) start ;
Box endBox = (Box) end ; Box endBox = (Box) end ;
if (startBox.getNeighbourList().contains(endBox)) { return startBox.getNeighbourList().contains(endBox) ? 1 : 0 ;
if (startBox.isWalkable() && endBox.isWalkable()) {
return 1 ;
}
else {
return 0 ;
}
}
return 0 ;
} }
public int getVertexNumber() { public int getVertexNumber() {
@@ -61,6 +52,11 @@ public class Maze
int y = box.getY() ; int y = box.getY() ;
ArrayList<VertexInterface> neighbourList = new ArrayList<VertexInterface>() ; ArrayList<VertexInterface> neighbourList = new ArrayList<VertexInterface>() ;
// Always returns an empty list if the departure box is a wall
if (! box.isWalkable()) {
return neighbourList ;
}
if (x > 0 && maze[x-1][y].isWalkable()) { if (x > 0 && maze[x-1][y].isWalkable()) {
neighbourList.add(maze[x-1][y]) ; neighbourList.add(maze[x-1][y]) ;
} }
@@ -180,7 +176,6 @@ public class Maze
} finally { } finally {
try { pw.close();} catch(Exception e) {} try { pw.close();} catch(Exception e) {}
} }
} }
public int getDimensionX() { public int getDimensionX() {