Merge branch 'fixUnneededCode' into lastDijsktraClasses
This commit was merged in pull request #5.
This commit is contained in:
10 files changed
+41
-98
No files matched your search
@@ -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>() ;
|
||||
@@ -11,20 +9,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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ 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 = hashPrevious;
|
||||
this.shortestPath = shortestPath;
|
||||
this.hashPrevious = new Hashtable<VertexInterface, VertexInterface>(hashPrevious);
|
||||
this.shortestPath = new ArrayList<VertexInterface>(shortestPath);
|
||||
}
|
||||
|
||||
public VertexInterface getPrevious(VertexInterface vertex) {
|
||||
@@ -36,8 +34,7 @@ public class Previous implements PreviousInterface {
|
||||
if (getPrevious(father) == null) return shortestPath ;
|
||||
else {
|
||||
return getShortestPathTo(father) ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,16 +6,9 @@ package dijkstra;
|
||||
*/
|
||||
public interface VertexInterface {
|
||||
|
||||
/**
|
||||
* Compares a <code>VertexInterface</code> to another.
|
||||
* @param vertex
|
||||
* The vertex to which the equality will be tested.
|
||||
* @return <code>true</code> is the two <code>VertexInterface</code> are the same, <code>false</code> if not.
|
||||
*/
|
||||
public boolean compareTo(VertexInterface vertex) ;
|
||||
|
||||
/**
|
||||
* @return The label of the element.
|
||||
*/
|
||||
public String getLabel() ;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user