@@ -12,7 +12,7 @@ public class Vertex {
1212 private Map <Vertex , Edge > edges = new HashMap <>();
1313 private boolean isVisited = false ;
1414
15- public Vertex (String label ){
15+ public Vertex (String label ) {
1616 this .label = label ;
1717 }
1818
@@ -28,7 +28,7 @@ public Map<Vertex, Edge> getEdges() {
2828 return edges ;
2929 }
3030
31- public void addEdge (Vertex vertex , Edge edge ){
31+ public void addEdge (Vertex vertex , Edge edge ) {
3232 this .edges .put (vertex , edge );
3333 }
3434
@@ -40,14 +40,15 @@ public void setVisited(boolean visited) {
4040 isVisited = visited ;
4141 }
4242
43- public Pair <Vertex , Edge > nextMinimum (){
43+ public Pair <Vertex , Edge > nextMinimum () {
4444 Edge nextMinimum = new Edge (Integer .MAX_VALUE );
4545 Vertex nextVertex = this ;
46- Iterator it = edges .entrySet ().iterator ();
46+ Iterator it = edges .entrySet ()
47+ .iterator ();
4748 while (it .hasNext ()) {
4849 Map .Entry pair = (Map .Entry ) it .next ();
49- if (!((Vertex )pair .getKey ()).isVisited ()){
50- if (!((Edge )pair .getValue ()).isIncluded ()) {
50+ if (!((Vertex ) pair .getKey ()).isVisited ()) {
51+ if (!((Edge ) pair .getValue ()).isIncluded ()) {
5152 if (((Edge ) pair .getValue ()).getWeight () < nextMinimum .getWeight ()) {
5253 nextMinimum = (Edge ) pair .getValue ();
5354 nextVertex = (Vertex ) pair .getKey ();
@@ -58,12 +59,13 @@ public Pair<Vertex, Edge> nextMinimum(){
5859 return new Pair <>(nextVertex , nextMinimum );
5960 }
6061
61- public String originalToString (){
62+ public String originalToString () {
6263 StringBuilder sb = new StringBuilder ();
63- Iterator it = edges .entrySet ().iterator ();
64+ Iterator it = edges .entrySet ()
65+ .iterator ();
6466 while (it .hasNext ()) {
6567 Map .Entry pair = (Map .Entry ) it .next ();
66- if (!((Edge )pair .getValue ()).isPrinted ()) {
68+ if (!((Edge ) pair .getValue ()).isPrinted ()) {
6769 sb .append (getLabel ());
6870 sb .append (" --- " );
6971 sb .append (((Edge ) pair .getValue ()).getWeight ());
@@ -76,14 +78,15 @@ public String originalToString(){
7678 return sb .toString ();
7779 }
7880
79- public String includedToString (){
81+ public String includedToString () {
8082 StringBuilder sb = new StringBuilder ();
8183 if (isVisited ()) {
82- Iterator it = edges .entrySet ().iterator ();
84+ Iterator it = edges .entrySet ()
85+ .iterator ();
8386 while (it .hasNext ()) {
8487 Map .Entry pair = (Map .Entry ) it .next ();
8588 if (((Edge ) pair .getValue ()).isIncluded ()) {
86- if (!((Edge )pair .getValue ()).isPrinted ()) {
89+ if (!((Edge ) pair .getValue ()).isPrinted ()) {
8790 sb .append (getLabel ());
8891 sb .append (" --- " );
8992 sb .append (((Edge ) pair .getValue ()).getWeight ());
@@ -98,4 +101,3 @@ public String includedToString(){
98101 return sb .toString ();
99102 }
100103}
101-
0 commit comments