Code cleanup
* Remove unwanted getters and setters * Properly handle object passed to constructors * Remove redundant condition check on ASet.contains()'s return * Make Maze.initFromTextFile() private
This commit is contained in:
5 files changed
+13
-25
No files matched your search
@@ -11,20 +11,19 @@ public class ASet implements ASetInterface {
|
||||
|
||||
public ASet(HashSet<VertexInterface> vertexHashSet) {
|
||||
|
||||
this.vertexHashSet = vertexHashSet;
|
||||
this.vertexHashSet = new HashSet<VertexInterface>(vertexHashSet);
|
||||
|
||||
}
|
||||
|
||||
public void add(VertexInterface vertex) {
|
||||
|
||||
vertexHashSet.add((Box)vertex) ;
|
||||
vertexHashSet.add(vertex) ;
|
||||
|
||||
}
|
||||
|
||||
public boolean contains(VertexInterface vertex) {
|
||||
|
||||
if (vertexHashSet.contains(vertex)) return true ;
|
||||
return false ;
|
||||
return vertexHashSet.contains(vertex);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class Pi implements PiInterface {
|
||||
|
||||
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) {
|
||||
|
||||
this.hashPrevious = hashPrevious;
|
||||
this.shortestPath = shortestPath;
|
||||
this.hashPrevious = new Hashtable<VertexInterface, VertexInterface>(hashPrevious);
|
||||
this.shortestPath = new ArrayList<VertexInterface>(shortestPath);
|
||||
}
|
||||
|
||||
public VertexInterface getPrevious(VertexInterface vertex) {
|
||||
|
||||
Reference in new issue
Block a user