[WIP] Useless code removal and code cleanup #5
No files matched your search
@@ -11,20 +11,19 @@ public class ASet implements ASetInterface {
|
|||||||
|
|
||||||
public ASet(HashSet<VertexInterface> vertexHashSet) {
|
public ASet(HashSet<VertexInterface> vertexHashSet) {
|
||||||
|
|
||||||
this.vertexHashSet = vertexHashSet;
|
this.vertexHashSet = new HashSet<VertexInterface>(vertexHashSet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(VertexInterface vertex) {
|
public void add(VertexInterface vertex) {
|
||||||
|
|
||||||
vertexHashSet.add((Box)vertex) ;
|
vertexHashSet.add(vertex) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(VertexInterface vertex) {
|
public boolean contains(VertexInterface vertex) {
|
||||||
|
|
||||||
if (vertexHashSet.contains(vertex)) return true ;
|
return vertexHashSet.contains(vertex);
|
||||||
return false ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class Pi implements PiInterface {
|
|||||||
|
|
||||||
public Pi(Hashtable<VertexInterface, Integer> hashPi) {
|
public Pi(Hashtable<VertexInterface, Integer> hashPi) {
|
||||||
|
|
||||||
this.hashPi = hashPi ;
|
this.hashPi = new Hashtable<VertexInterface, Integer>(hashPi);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ public class Previous implements PreviousInterface {
|
|||||||
|
|
||||||
public Previous(Hashtable<VertexInterface, VertexInterface> hashPrevious, ArrayList<VertexInterface> shortestPath) {
|
public Previous(Hashtable<VertexInterface, VertexInterface> hashPrevious, ArrayList<VertexInterface> shortestPath) {
|
||||||
|
|
||||||
this.hashPrevious = hashPrevious;
|
this.hashPrevious = new Hashtable<VertexInterface, VertexInterface>(hashPrevious);
|
||||||
this.shortestPath = shortestPath;
|
this.shortestPath = new ArrayList<VertexInterface>(shortestPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VertexInterface getPrevious(VertexInterface vertex) {
|
public VertexInterface getPrevious(VertexInterface vertex) {
|
||||||
|
|||||||
+7
-14
@@ -21,6 +21,12 @@ public class Maze
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public Maze(Box[][] maze){
|
||||||
|
// //Replacement for setMaze()
|
||||||
|
// //Todo : check if the given array is a proper maze
|
||||||
|
// //and then set dimensionX and dimensionX
|
||||||
|
// }
|
||||||
|
|
||||||
public int getCost(VertexInterface start, VertexInterface end) {
|
public int getCost(VertexInterface start, VertexInterface end) {
|
||||||
|
|
||||||
Box startBox = (Box) start ;
|
Box startBox = (Box) start ;
|
||||||
@@ -77,7 +83,7 @@ public class Maze
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void initFromTextFile(String filename) {
|
private final void initFromTextFile(String filename) {
|
||||||
|
|
||||||
FileReader fr = null ;
|
FileReader fr = null ;
|
||||||
BufferedReader br = null ;
|
BufferedReader br = null ;
|
||||||
@@ -182,25 +188,12 @@ public class Maze
|
|||||||
return dimensionX;
|
return dimensionX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDimensionX(int dimensionX) {
|
|
||||||
this.dimensionX = dimensionX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDimensionY() {
|
public int getDimensionY() {
|
||||||
return dimensionY;
|
return dimensionY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDimensionY(int dimensionY) {
|
|
||||||
this.dimensionY = dimensionY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Box[][] getMaze() {
|
public Box[][] getMaze() {
|
||||||
return maze;
|
return maze;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaze(Box[][] maze) {
|
|
||||||
this.maze = maze;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,4 @@ public class MazeReadingException
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFilename() {
|
|
||||||
return filename ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user