Final Improvements
This commit is contained in:
parent
2213a4385d
commit
c900f07f89
@ -76,9 +76,9 @@ public class OurAlgorithm extends Algorithm {
|
||||
info.setContentPane(contentpane);
|
||||
JOptionPane.showMessageDialog(
|
||||
contentpane,
|
||||
"Bitte geben SIe einen gültige Graphen an. Hilfestellung für das Erstellen von Knoten und Kanten:\n" +
|
||||
"Bitte geben Sie einen gültigen Graphen an. Hilfestellung für das Erstellen von Knoten und Kanten:\n" +
|
||||
"Knoten: Name;X-Coordinate;Y-Coordinate\nKanten: StartKnoten;Endknoten;Gewichtung\n" +
|
||||
"Hinweis: ein Koten benötigt den Namen 'Startknoten', ein anderer 'Endknoten'\n" +
|
||||
"Hinweis: ein Koten benötigt den Namen 'Start', ein anderer 'Ende'\n" +
|
||||
"(Festlegen der Start und Endknoten für die Algorithmen)",
|
||||
"Eingabefehler",
|
||||
JOptionPane.INFORMATION_MESSAGE,
|
||||
|
@ -146,19 +146,21 @@ public class OurParameterArea extends ParameterArea {
|
||||
}
|
||||
|
||||
// Create edges
|
||||
MarkedVertex<VertexMarking> start = null;
|
||||
MarkedVertex<VertexMarking> end = null;
|
||||
for (String i: allEdges) {
|
||||
String[] current = i.split("-");
|
||||
for (MarkedVertex<VertexMarking> j: newGraph.getAllVertexes()) {
|
||||
if (Objects.equals(j.getName(), current[0])) {
|
||||
start = j;
|
||||
}
|
||||
if (Objects.equals(j.getName(), current[1])) {
|
||||
end = j;
|
||||
if(allEdges.length != 1 || !Objects.equals(allEdges[0], "")){
|
||||
MarkedVertex<VertexMarking> start = null;
|
||||
MarkedVertex<VertexMarking> end = null;
|
||||
for (String i: allEdges) {
|
||||
String[] current = i.split("-");
|
||||
for (MarkedVertex<VertexMarking> j: newGraph.getAllVertexes()) {
|
||||
if (Objects.equals(j.getName(), current[0])) {
|
||||
start = j;
|
||||
}
|
||||
if (Objects.equals(j.getName(), current[1])) {
|
||||
end = j;
|
||||
}
|
||||
}
|
||||
newGraph.addEdge(new MarkedEdge<>(i, start, end, new EdgeWeightMarking(Integer.parseInt(current[2]))));
|
||||
}
|
||||
newGraph.addEdge(new MarkedEdge<>(i, start, end, new EdgeWeightMarking(Integer.parseInt(current[2]))));
|
||||
}
|
||||
//Fehlerbehandlung
|
||||
}catch(Throwable e){
|
||||
@ -169,7 +171,7 @@ public class OurParameterArea extends ParameterArea {
|
||||
contentpane,
|
||||
"Fehler bei der Eingabe des Graphen. Beispieleingabe für Knoten und Kanten:\n" +
|
||||
"Knoten: Name;X-Coordinate;Y-Coordinate\nKanten: StartKnoten;Endknoten;Gewichtung\n" +
|
||||
"Hinweis: ein Koten benötigt den Namen 'Startknoten', ein anderer 'Endknoten'\n" +
|
||||
"Hinweis: ein Koten benötigt den Namen 'Start', ein anderer 'Ende'\n" +
|
||||
"(Festlegen der Start und Endknoten für die Algorithmen)",
|
||||
"Eingabefehler",
|
||||
JOptionPane.INFORMATION_MESSAGE,
|
||||
|
@ -419,19 +419,26 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
}
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
// Falls kein Weg gefunden wurde
|
||||
if (predecessors.get(n2) == null) {
|
||||
textDescription = "Kein Weg gefunden!";
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}else{
|
||||
// Falls ein Weg gefunden wurde
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
}
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
|
||||
System.out.println("Done");
|
||||
// Gibt Distanz zu gefragtem Knoten zurück
|
||||
return distance.get(n2);
|
||||
@ -568,19 +575,26 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
}
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
// Falls kein Weg gefunden wurde
|
||||
if (predecessors.get(n2) == null) {
|
||||
textDescription = "Kein Weg gefunden!";
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}else{
|
||||
// Falls ein Weg gefunden wurde
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
}
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
|
||||
System.out.println("Done");
|
||||
// Gibt Distanz zu gefragtem Knoten zurück
|
||||
return distance.get(n2);
|
||||
|
@ -324,19 +324,26 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
}
|
||||
}
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
// Falls kein Weg gefunden wurde
|
||||
if (predecessors.get(n2) == null) {
|
||||
textDescription = "Kein Weg gefunden!";
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}else{
|
||||
// Falls ein Weg gefunden wurde
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
}
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
|
||||
System.out.println("Done");
|
||||
// Gibt Distanz zu gefragtem Knoten zurück
|
||||
return distance.get(n2);
|
||||
@ -469,19 +476,26 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
}
|
||||
}
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
// Falls kein Weg gefunden wurde
|
||||
if (predecessors.get(n2) == null) {
|
||||
textDescription = "Kein Weg gefunden!";
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}else{
|
||||
// Falls ein Weg gefunden wurde
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
}
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
|
||||
MarkedVertex<T> colorroute = n2;
|
||||
while (colorroute != null) {
|
||||
textDescription = colorroute.getName();
|
||||
System.out.println(textDescription);
|
||||
colorroute.getScreenVertex().setColor(Color.green);
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
colorroute = predecessors.get(colorroute);
|
||||
}
|
||||
|
||||
System.out.println("Done");
|
||||
// Gibt Distanz zu gefragtem Knoten zurück
|
||||
return distance.get(n2);
|
||||
|
1
out/production/ProjektGraph/.gitignore
vendored
1
out/production/ProjektGraph/.gitignore
vendored
@ -1 +1,2 @@
|
||||
/out/
|
||||
/.idea/
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user