Aufgabe 6 finish

This commit is contained in:
i23007 2024-07-08 23:17:38 +02:00
parent 3c709ec120
commit 0be3b82e7b
13 changed files with 12 additions and 26 deletions

View File

@ -31,7 +31,7 @@ public class OurAlgorithm extends Algorithm {
* @param parameterArea the sum up parameter area the algorithm gets its parameters from
*/
public OurAlgorithm(OurParameterArea parameterArea, OurMethodButtons methodButtons){
super(parameterArea,"GraphAlgorithm");
super(parameterArea,"Thema II: Kürzeste Wege");
this.methodButtons = methodButtons;
}
@ -47,7 +47,7 @@ public class OurAlgorithm extends Algorithm {
this.setCurrentGraph(((OurParameterArea) this.getParameterArea()).getSelectedGraph());
/*
MarkedVertex<VertexMarking> start = null;
for (MarkedVertex<VertexMarking> i: this.currentGraph.getAllVertexes()) {
if (Objects.equals(i.getName(), "Start")) {
@ -63,13 +63,11 @@ public class OurAlgorithm extends Algorithm {
}
*/
Random random = new Random();
/*Random random = new Random();
MarkedVertex<VertexMarking> start = this.currentGraph.getAllVertexes().get(random.nextInt(this.currentGraph.getAllVertexes().size()));
MarkedVertex<VertexMarking> end = this.currentGraph.getAllVertexes().get(random.nextInt(this.currentGraph.getAllVertexes().size()));
System.out.println(start.getName() + " to " + end.getName());
System.out.println(start.getName() + " to " + end.getName());*/
if(this.methodButtons.getSelectedMethod()){

View File

@ -57,8 +57,6 @@ public class OurApplication {
OurLegendArea legendArea = new OurLegendArea();
OurHybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea, OurMethodButtons> applet = new OurHybridWindow<>(drawArea, textArea, parameterArea, algorithm, logList, legendArea, methodButtons);
JFrame frame = new JFrame("Visualise");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(applet);

View File

@ -62,8 +62,10 @@ public class OurParameterArea extends ParameterArea{
buttonAddGraph = new JButton("Graph einfügen");
// Eingabefelder
textField1 = new JTextField("Knoten");
textField2 = new JTextField("Kanten");
textField1 = new JTextField("A-100-100;Ende-200-200;Start-100-200;D-200-100");
textField2 = new JTextField("A-Ende-15;Start-D-10;D-A-3;A-Ende-15;Start-D-10;D-A-3");
textField1.setPreferredSize(new Dimension(button5.getWidth(), button5.getHeight()));
textField2.setPreferredSize(new Dimension(button5.getWidth(), button5.getHeight()));
// ButtonGroup erstellen und Buttons hinzufügen, um die gegenseitige Ausschließung zu gewährleisten
@ -125,8 +127,8 @@ public class OurParameterArea extends ParameterArea{
}
// Vertex Eingabe: A-100-100;B-200-200;C-100-200;D-200-100
// Edge Eingabe: A-B-15;C-D-10;D-A-3
// Vertex Beispiel-Eingabe: A-100-100;Ende-200-200;Start-100-200;D-200-100
// Edge Beispiel-Eingabe: A-B-15;C-D-10;D-A-3
public DirectedGraph<VertexMarking, EdgeMarking> createGraph(String vertices, String edges) {
DirectedGraph<VertexMarking, EdgeMarking> newGraph = new DirectedGraph<>();
@ -146,7 +148,8 @@ public class OurParameterArea extends ParameterArea{
for (MarkedVertex<VertexMarking> j: newGraph.getAllVertexes()) {
if (Objects.equals(j.getName(), current[0])) {
start = j;
} else if (Objects.equals(j.getName(), current[1])) {
}
if (Objects.equals(j.getName(), current[1])) {
end = j;
}
}

View File

@ -585,9 +585,4 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
// Gibt Distanz zu gefragtem Knoten zurück
return distance.get(n2);
}
public void createLoglistElement() {
this.logList.add(new OurLogElement(0, "", 0, this.getScreenGraphCopy()));
}
}

View File

@ -413,8 +413,5 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
* @return Length of the shortest path between the vertices.
*/
public abstract double getShortestPathAStar(MarkedVertex<T> n1, MarkedVertex<T> n2);
public abstract void createLoglistElement();
}

View File

@ -486,9 +486,4 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
// Gibt Distanz zu gefragtem Knoten zurück
return distance.get(n2);
}
public void createLoglistElement() {
this.logList.add(new OurLogElement(0, "", 0, this.getScreenGraphCopy()));
}
}