diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f3e011e..ea118c5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,17 +4,19 @@
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
@@ -24,8 +26,8 @@
@@ -49,17 +51,18 @@
- {
+ "keyToString": {
+ "DefaultHtmlFileTemplate": "HTML File",
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+ "git-widget-placeholder": "main",
+ "kotlin-language-version-configured": "true",
+ "last_opened_file_path": "C:/Users/jonas/DHBW Dateien/Semester 2/Programmieren 2/Projekt/ProjektGraph/OurApplication",
+ "settings.editor.selected.configurable": "vcs.Git"
}
-}]]>
+}
@@ -88,7 +91,15 @@
1719479266810
-
+
+
+ 1719493522512
+
+
+
+ 1719493522512
+
+
@@ -104,17 +115,7 @@
-
-
-
-
-
-
- file://$PROJECT_DIR$/OurApplication/OurApplication.java
- 56
-
-
-
-
+
+
\ No newline at end of file
diff --git a/OurApplication/OurAlgorithm.java b/OurApplication/OurAlgorithm.java
index 4dc83ac..eb9c1d4 100644
--- a/OurApplication/OurAlgorithm.java
+++ b/OurApplication/OurAlgorithm.java
@@ -1,8 +1,11 @@
package OurApplication;
+import graph.*;
import logging.Algorithm;
import logging.LogElementList;
+import java.util.Random;
+
/**
* This class provides an example for using logging.Algorithm.
* It sums up integer number starting with 0 up to the maximum value specified in the parameter area.
@@ -33,14 +36,27 @@ public class OurAlgorithm extends Algorithm{
*/
public LogElementList run(){
LogElementListlogList = new LogElementList();
- for(int i=1;i<=10;i++){
+ for(int x=1;x<=10;x++){
+ Random random = new Random();
+ DirectedGraph myGraph = new DirectedGraph<>();
+ for (int i = 0; i < 10; i++) {
+ myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null, random.nextInt(i, 350), random.nextInt(i, 350)));
+ }
+
+ for (MarkedVertex i: myGraph.getAllVertexes()) {
+ myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
+ }
+
+ for (MarkedVertex i: myGraph.getAllVertexes()) {
+ myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
+ }
+
try{
-
- logList.add(new OurLogElement(i, "Value", i));
+ logList.add(new OurLogElement(x, "Value", x, myGraph));
}
catch(OutOfMemoryError e){
- System.err.println("Out of memory");
+ System.err.println("Out of memory");
}
}
return logList;
diff --git a/OurApplication/OurApplication.java b/OurApplication/OurApplication.java
index eb3c5d8..235f330 100644
--- a/OurApplication/OurApplication.java
+++ b/OurApplication/OurApplication.java
@@ -39,20 +39,6 @@ public class OurApplication {
*/
public static void main(String[]args){
- DirectedGraph myGraph = new DirectedGraph<>();
-
- for (int i = 0; i < 10; i++) {
- myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null));
- }
- Random random = new Random();
-
- for (MarkedVertex i: myGraph.getAllVertexes()) {
- myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
- }
-
- for (MarkedVertex i: myGraph.getAllVertexes()) {
- myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
- }
LogElementListlogList=new LogElementList();
OurParameterArea parameterArea=new OurParameterArea();
diff --git a/OurApplication/OurDrawArea.java b/OurApplication/OurDrawArea.java
index 341d059..f895474 100644
--- a/OurApplication/OurDrawArea.java
+++ b/OurApplication/OurDrawArea.java
@@ -1,10 +1,15 @@
package OurApplication;
+import graph.*;
+import logging.LogElement;
import logging.LogElementList;
import visualisation.DrawArea;
+import visualizationElements.Edge;
+import visualizationElements.Graph;
import visualizationElements.List;
import visualizationElements.Queue;
import visualizationElements.*;
+import visualizationElements.Vertex;
import java.awt.*;
import java.util.Vector;
@@ -43,38 +48,33 @@ public class OurDrawArea extends DrawArea{
public void draw(Graphics g){
- drawGraph(g);
+ OurLogElement logElement=(OurLogElement)logList.get();
+ drawGraph(logElement.getGraph(), g);
+
}
- private void drawGraph(Graphics g) {
-
- // create/add vertexes
+ private void drawGraph(DirectedGraph ourGraph, Graphics g) {
+ String convertedMarking;
+
Vector vertexes = new Vector();
-
- vertexes.add(new Vertex(20, 20, "1", Color.BLACK));
- vertexes.add(new Vertex(80, 20, "2", Color.BLACK));
- vertexes.add(new Vertex(100, 80, "3", Color.BLACK));
- vertexes.add(new Vertex(180, 60, "4", Color.BLUE));
- vertexes.add(new Vertex(20, 80, "5", Color.BLACK));
- vertexes.add(new Vertex(120, 140, "6", Color.BLACK));
- vertexes.add(new Vertex(20, 180, "7", Color.BLACK));
-
-
- // create/add edges
+
+ for(MarkedVertex i : ourGraph.getAllVertexes()){
+ if(i.getMarking() != null){
+ convertedMarking = i.getMarking().toString();
+ }else{
+ convertedMarking = "";
+ }
+ vertexes.add(new Vertex(i.getXCoordinate(), i.getYCoordinate(), convertedMarking, Color.BLUE));
+ }
+
Vector edges = new Vector();
-
- edges.add(new Edge(vertexes.get(0), vertexes.get(1), "1", Color.WHITE));
- edges.add(new Edge(vertexes.get(1), vertexes.get(4), "1", Color.BLACK));
- edges.add(new Edge(vertexes.get(0), vertexes.get(4), "1", Color.BLACK));
- edges.add(new Edge(vertexes.get(2), vertexes.get(3), "1", Color.BLACK));
- edges.add(new Edge(vertexes.get(3), vertexes.get(2), "1", Color.BLACK));
- edges.add(new Edge(vertexes.get(4), vertexes.get(6), "1", Color.BLACK));
- edges.add(new Edge(vertexes.get(6), vertexes.get(6), "1", Color.BLACK));
-
-
- // create graph
- Graph graph = new Graph(vertexes, edges, false, EdgeStyle.Direct);
-
+
+ for(MarkedEdge i : ourGraph.getAllEdges()){
+ edges.add(new Edge(vertexes.get(0), vertexes.get(5), "i.getMarking()", Color.BLACK));
+ }
+
+ Graph graph = new Graph(vertexes, edges, true, EdgeStyle.Direct);
+
graph.draw(g);
}
}
diff --git a/OurApplication/OurLogElement.java b/OurApplication/OurLogElement.java
index 0f9936d..1e17bb7 100644
--- a/OurApplication/OurLogElement.java
+++ b/OurApplication/OurLogElement.java
@@ -1,5 +1,8 @@
package OurApplication;
+import graph.DirectedGraph;
+import graph.EdgeMarking;
+import graph.VertexMarking;
import logging.LogElement;
/**
@@ -15,6 +18,7 @@ public class OurLogElement extends LogElement{
/** The log elements sum up value. */
protected long value;
+ protected DirectedGraph ourGraph;
/**
* Standard constructor.
@@ -32,10 +36,11 @@ public class OurLogElement extends LogElement{
* @param description the log element's step description
* @param value the log element's sum up value
*/
- public OurLogElement(int step, String description, long value){
+ public OurLogElement(int step, String description, long value, DirectedGraph ourGraph){
this.step=step;
this.description=description;
this.value=value;
+ this.ourGraph = ourGraph;
}
/**
@@ -45,5 +50,8 @@ public class OurLogElement extends LogElement{
public long getValue(){
return value;
}
+ public DirectedGraph getGraph(){
+ return this.ourGraph;
+ }
}
diff --git a/graph/DirectedGraph.java b/graph/DirectedGraph.java
index 9c0a6e0..c3a017f 100644
--- a/graph/DirectedGraph.java
+++ b/graph/DirectedGraph.java
@@ -1,5 +1,6 @@
package graph;
+import java.awt.*;
import java.util.HashMap;
import java.util.Objects;
import java.util.PriorityQueue;
diff --git a/graph/Display.java b/graph/Display.java
index 93a3861..1025f10 100644
--- a/graph/Display.java
+++ b/graph/Display.java
@@ -8,7 +8,7 @@ public class Display {
DirectedGraph myGraph = new DirectedGraph<>();
for (int i = 0; i < 10; i++) {
- myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null));
+ myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null, i, i));
}
Random random = new Random();
diff --git a/graph/MarkedVertex.java b/graph/MarkedVertex.java
index 73081bb..5203df3 100644
--- a/graph/MarkedVertex.java
+++ b/graph/MarkedVertex.java
@@ -14,9 +14,11 @@ public class MarkedVertex extends Vertex{
}
- public MarkedVertex(String s, T t) {
+ public MarkedVertex(String s, T t, int x, int y) {
super(s);
this.marking = t;
+ this.setXCoordinate(x);
+ this.setYCoordinate(y);
}
diff --git a/graph/Vertex.java b/graph/Vertex.java
index cdf7654..fbb5e42 100644
--- a/graph/Vertex.java
+++ b/graph/Vertex.java
@@ -5,6 +5,8 @@ public abstract class Vertex {
// ATTRIBUTE
private String name;
+ private int xCoordinate;
+ private int yCoordinate;
// KONSTRUKTOREN
@@ -24,13 +26,23 @@ public abstract class Vertex {
public String getName() {
return this.name;
}
-
-
+ public int getXCoordinate(){
+ return this.xCoordinate;
+ }
+ public int getYCoordinate(){
+ return this.yCoordinate;
+ }
// SET-ER
public void setName(String s) {
this.name = s;
}
+ public void setXCoordinate(int xCoordinate){
+ this.xCoordinate=xCoordinate;
+ }
+ public void setYCoordinate(int yCoordinate){
+ this.yCoordinate=yCoordinate;
+ }
}
diff --git a/graph/VertexMarking.java b/graph/VertexMarking.java
index 59257b9..c577d43 100644
--- a/graph/VertexMarking.java
+++ b/graph/VertexMarking.java
@@ -1,4 +1,5 @@
package graph;
public abstract class VertexMarking extends Marking {
+ private String mark;
}
diff --git a/logging/LogElement.java b/logging/LogElement.java
index ae46e45..feda38b 100644
--- a/logging/LogElement.java
+++ b/logging/LogElement.java
@@ -1,5 +1,8 @@
package logging;
+import graph.DirectedGraph;
+import graph.EdgeMarking;
+import graph.VertexMarking;
import visualisation.HybridWindow;
/**