Add toString method for Box Add code to print the shortest path for this particular case.
33 lines
580 B
Java
33 lines
580 B
Java
package dijkstra;
|
|
|
|
import java.util.HashSet;
|
|
|
|
public class ASet implements ASetInterface {
|
|
|
|
private HashSet<VertexInterface> vertexHashSet = new HashSet<VertexInterface>() ;
|
|
|
|
|
|
public ASet(HashSet<VertexInterface> vertexHashSet) {
|
|
|
|
this.vertexHashSet = new HashSet<VertexInterface>(vertexHashSet);
|
|
|
|
}
|
|
|
|
public void add(VertexInterface vertex) {
|
|
|
|
vertexHashSet.add(vertex) ;
|
|
|
|
}
|
|
|
|
public boolean contains(VertexInterface vertex) {
|
|
|
|
return vertexHashSet.contains(vertex);
|
|
|
|
}
|
|
|
|
public HashSet<VertexInterface> getVertexHashSet() {
|
|
return vertexHashSet;
|
|
}
|
|
|
|
}
|