Reset main

Revert "Für Christian"

This reverts commit 213638ad16.

Revert "Visualisation progress"

This reverts commit 12dbadf5e1.

Revert "OurApplication test"This reverts commit 6b0caa1a5e.

Revert "Visualisation tests"

This reverts commit cf63dddf51.
This commit is contained in:
cmerkens 2024-07-03 20:18:47 +02:00
parent 213638ad16
commit 0904358705
136 changed files with 166 additions and 921 deletions

View File

@ -2,9 +2,7 @@
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>

2
.idea/misc.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

87
.idea/workspace.xml generated
View File

@ -1,75 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="OurApplication test">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/OurApplication/OurAlgorithm.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurAlgorithm.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/OurApplication/OurDrawArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurDrawArea.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/graph/DirectedGraph.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/DirectedGraph.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/graph/Graph.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/Graph.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/graph/MarkedVertex.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/MarkedVertex.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/graph/Vertex.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/Vertex.java" afterDir="false" />
</list>
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="HTML File" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Merge.Settings">
<option name="BRANCH" value="VisualisationTests" />
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="main" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 2
}</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 2
}]]></component>
<component name="ProjectId" id="2hxt4apXjGaBR1xypJAsjIrgc8R" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Application.OurApplication.executor": "Run",
"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"
"last_opened_file_path": "C:/Git/ProjektGraph"
}
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\OurApplication" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\visualizationElements" />
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\testApplication" />
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\logging" />
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\visualisation" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
@ -79,39 +35,6 @@
<option name="presentableId" value="Default" />
<updated>1718547365327</updated>
</task>
<task id="LOCAL-00001" summary="Visualisation tests">
<option name="closed" value="true" />
<created>1719479266810</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1719479266810</updated>
</task>
<task id="LOCAL-00002" summary="OurApplication test">
<option name="closed" value="true" />
<created>1719493522512</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1719493522512</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Visualisation tests" />
<MESSAGE value="OurApplication test" />
<option name="LAST_COMMIT_MESSAGE" value="OurApplication test" />
</component>
</project>

View File

@ -1,31 +0,0 @@
import OurApplication.*;
import graph.EdgeMarking;
import graph.MarkedEdge;
import graph.MarkedVertex;
import graph.VertexMarking;
import visualisation.*;
import logging.*;
import visualisation.TextArea;
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args){
JFrame t = new JFrame("Hallo");
JPanel contentPane = new JPanel(new GridLayout());
t.setSize(900, 900);
t.setContentPane(contentPane);
LogElementList<OurLogElement>logList=new LogElementList<OurLogElement>();
OurParameterArea parameterArea=new OurParameterArea();
OurDrawArea drawArea=new OurDrawArea(logList,"visualizationTest");
OurTextArea textArea=new OurTextArea(logList);
OurAlgorithm algorithm=new OurAlgorithm(parameterArea);
OurLegendArea legendArea=new OurLegendArea();
HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> test = new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea,textArea,parameterArea,algorithm,logList,legendArea);
test.init();
contentPane.add(test);
t.setVisible(true);
}
}

View File

@ -1,7 +1,6 @@
package logging;
import visualisation.HybridWindow;
import visualisation.ParameterArea;
import visualization.ParameterArea;
/**
* This class provides the basic algorithm.
@ -11,9 +10,9 @@ import visualisation.ParameterArea;
* Parameters for algorithm processing are read from member parameterArea that ist part of the user interface.
* @see logging.LogElement
* @see logging.LogElementList
* @see HybridWindow
* @see ParameterArea
* @author Bj<EFBFBD>rn Strobel<br><small>
* @see visualization.HybridWindow
* @see visualization.ParameterArea
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -1,10 +1,5 @@
package logging;
import graph.DirectedGraph;
import graph.EdgeMarking;
import graph.VertexMarking;
import visualisation.HybridWindow;
/**
* This class provides the basic log list element.
* Use it in assoziation with packages logging and visualization.
@ -12,8 +7,8 @@ import visualisation.HybridWindow;
* Extend it by the members you need.
* @see logging.Algorithm
* @see logging.LogElementList
* @see HybridWindow
* @author Bj<EFBFBD>rn Strobel<br><small>
* @see visualization.HybridWindow
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -1,7 +1,5 @@
package logging;
import visualisation.HybridWindow;
import java.util.Vector;
/**
@ -10,9 +8,9 @@ import java.util.Vector;
* In general you will not have to extend this class so it is final.
* @see logging.Algorithm
* @see logging.LogElement
* @see HybridWindow
* @see visualization.HybridWindow
* @see java.util.Vector
* @author Bj<EFBFBD>rn Strobel<br><small>
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -3,7 +3,7 @@ package testApplication;
import javax.swing.JFrame;
import logging.LogElementList;
import visualisation.HybridWindow;
import visualization.HybridWindow;
/**
* This application provides an example for using logging and visualization packages.
@ -17,7 +17,7 @@ import visualisation.HybridWindow;
* @see testApplication.TestTextArea
* @see testApplication.TestLegendArea
* @see javax.swing.JPanel
* @author MSch<EFBFBD>fer
* @author MSchäfer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/

View File

@ -4,7 +4,7 @@ import java.awt.Color;
import java.awt.Graphics;
import java.util.Vector;
import visualisation.DrawArea;
import visualization.DrawArea;
import visualizationElements.BarChart;
import visualizationElements.BarChartElement;
import visualizationElements.ChessBoard;
@ -25,7 +25,7 @@ import logging.LogElementList;
/**
* This class provides an example for using visualization.DrawArea.
* @see logging.Algorithm
@author MSch<EFBFBD>fer
@author MSchäfer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/

View File

@ -1,15 +1,15 @@
package testApplication;
import logging.LogElementList;
import visualisation.HybridWindow;
import visualization.HybridWindow;
/**
* This class provides an example for using visualization.HybridWindow.
* Overwriting the constructor is necessary to run as an applet.
* For running as an application overwriting the constructor is not necessary
* @see HybridWindow
* @see visualization.HybridWindow
* @see testApplication.TestApplication
* @author MSch<EFBFBD>fer
* @author MSchäfer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/

View File

@ -3,12 +3,12 @@ package testApplication;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import visualisation.LegendArea;
import visualization.LegendArea;
/**
* This class represents a visualization.LegendArea implementation and has been created for demonstration purposes only.
* Method initialize(Graphics) is overridden and now implements logic for drawing parameters on the legend area.
* @author MSch<EFBFBD>fer
* @author MSchäfer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/

View File

@ -2,12 +2,12 @@ package testApplication;
import javax.swing.BorderFactory;
import javax.swing.JTextField;
import visualisation.ParameterArea;
import visualization.ParameterArea;
/**
* This class provides an example for using visualization.ParameterArea.
* @see ParameterArea
* @author MSch<EFBFBD>fer
* @see visualization.ParameterArea
* @author MSchäfer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/

View File

@ -1,13 +1,13 @@
package testApplication;
import logging.LogElementList;
import visualisation.TextArea;
import visualization.TextArea;
/**
* This class provides an example for using visualization.TextArea.
* Constructors and print() method have been overwritten.
* @see TextArea
* @author MSch<EFBFBD>fer
* @see visualization.TextArea
* @author MSchäfer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/

View File

@ -1,7 +1,7 @@
/**
*
*/
package visualisation;
package visualization;
import java.awt.Color;
import java.awt.Graphics;
@ -19,9 +19,9 @@ import logging.LogElementList;
* Parameters for algorithm processing are read from member parameterArea that ist part of the user interface.
* @see logging.LogElement
* @see logging.LogElementList
* @see HybridWindow
* @see visualization.HybridWindow
* @see javax.swing.JPanel
* @author Bj<EFBFBD>rn Strobel<br><small>
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -1,4 +1,4 @@
package visualisation;
package visualization;
import java.lang.Math;
@ -12,6 +12,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.JApplet;
@ -41,12 +42,12 @@ import logging.LogElementList;
* @see logging.Algorithm
* @see logging.LogElement
* @see logging.LogElementList
* @see DrawArea
* @see ParameterArea
* @see TextArea
* @see LegendArea
* @see visualization.DrawArea
* @see visualization.ParameterArea
* @see visualization.TextArea
* @see visualization.LegendArea
* @see javax.swing.JApplet
* @author Bj<EFBFBD>rn Strobel<br><small>
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -1,4 +1,4 @@
package visualisation;
package visualization;
import java.awt.Graphics;
@ -9,7 +9,7 @@ import javax.swing.JScrollPane;
* This class enables the user to add a legend area for describing the elements and symbols of an algorithm's visualization.
* Override method initialize(Graphics) for drawing your legend area's graphical output.
* @see javax.swing.JPanel
* @see HybridWindow
* @see visualization.HybridWindow
* @author Fabian Hamm
* DHBW Stuttgart Campus Horb
*/

View File

@ -1,7 +1,7 @@
/**
*
*/
package visualisation;
package visualization;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@ -10,9 +10,9 @@ import javax.swing.JScrollPane;
* This class provides the basic parameter input area for an algorithm visualization.
* Add the components and corresponding methods you need and use them in your algorithm.
* @see logging.Algorithm
* @see HybridWindow
* @see visualization.HybridWindow
* @see javax.swing.JPanel
* @author Bj<EFBFBD>rn Strobel<br><small>
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -1,7 +1,7 @@
/**
*
*/
package visualisation;
package visualization;
import java.awt.Color;
import java.awt.Font;
@ -20,12 +20,12 @@ import logging.LogElementList;
* @see logging.Algorithm
* @see logging.LogElement
* @see logging.LogElementList
* @see DrawArea
* @see HybridWindow
* @see ParameterArea
* @see TextArea
* @see visualization.DrawArea
* @see visualization.HybridWindow
* @see visualization.ParameterArea
* @see visualization.TextArea
* @see javax.swing.JTextArea
* @author Bj<EFBFBD>rn Strobel<br><small>
* @author Björn Strobel<br><small>
* University of Cooperative Education Stuttgart,
* Campus Horb<br>
* Department of Information Technology<br>

View File

@ -1,111 +0,0 @@
package OurApplication;
import graph.*;
import logging.Algorithm;
import logging.LogElementList;
import java.awt.*;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Vector;
/**
* 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.
* @see Algorithm
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurAlgorithm extends Algorithm{
public OurAlgorithm() {
super();
}
/**
* Creates a sum up algorithm.
* @param parameterArea the sum up parameter area the algorithm gets its parameters from
*/
public OurAlgorithm(OurParameterArea parameterArea){
super(parameterArea,"GraphAlgorithm");
}
/**
* Overwritten from super class.
* Runs the algorithm..
* Returns the LogElementList produced by the algorithm processing.
* Adds integer number starting with 0 up to the maximum value.
* @return a LogElementList containing the algorithm processing single steps
*/
public LogElementList run(){
LogElementList<OurLogElement>logList = new LogElementList<OurLogElement>();
/*
for(int x=1;x<=10;x++){
Random random = new Random();
DirectedGraph<VertexMarking, EdgeMarking> 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<VertexMarking> i: myGraph.getAllVertexes()) {
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
}
for (MarkedVertex<VertexMarking> 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(x, "Value", x, myGraph));
}
catch(OutOfMemoryError e){
System.err.println("Out of memory");
}
}
*/
Random random = new Random();
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
for (int i = 0; i < 10; i++) {
myGraph.addVertex(new MarkedVertex<>(random.nextInt(i, 350), random.nextInt(i, 350), String.valueOf(i) + " :", Color.BLACK , null));
}
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
}
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
}
MarkedVertex<VertexMarking> start = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size()));
MarkedVertex<VertexMarking> end = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size()));
Vector<DirectedGraph<VertexMarking, EdgeMarking>> items = new Vector<>();
items = myGraph.DikstraVisualization(start, end);
for(DirectedGraph<VertexMarking, EdgeMarking> i : items){
logList.add(new OurLogElement(1, "Value", 1, i));
}
return logList;
}
//Erstelle eines zufälligen Graphen
//Auf den graphen Diktra aufrufen --> liefert Vektor mit Steps
//for each über die Steps und fügen sie zur Loglist hinzu
//return die Log list
}

View File

@ -1,62 +0,0 @@
package OurApplication;
import graph.*;
import logging.LogElementList;
import visualisation.HybridWindow;
import javax.swing.*;
import java.util.Random;
/**
* This application provides an example for using logging and visualization packages.
* It uses extended classes from logging and visualization.
* @see OurAlgorithm
* @see OurApplication
* @see OurDrawArea
* @see OurHybridWindow
* @see OurLogElement
* @see OurParameterArea
* @see OurTextArea
* @see OurLegendArea
* @see javax.swing.JPanel
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurApplication {
/**
* Standard constructor.
*/
public OurApplication() {
super();
}
/**
* The applications main method.
* Creates a HybridWindow with TestParameterArea, TestLegendArea ,TestDrawArea, TestTextArea and TestAlgorithm and starts it.
* @param args
*/
public static void main(String[]args){
LogElementList<OurLogElement>logList=new LogElementList<OurLogElement>();
OurParameterArea parameterArea=new OurParameterArea();
OurDrawArea drawArea=new OurDrawArea(logList,"GraphVisualization");
OurTextArea textArea=new OurTextArea(logList);
OurAlgorithm algorithm=new OurAlgorithm(parameterArea);
OurLegendArea legendArea=new OurLegendArea();
HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> applet=new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea,textArea,parameterArea,algorithm,logList,legendArea);
JFrame frame=new JFrame("Visualise");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(applet);
frame.pack();
applet.init();
applet.start();
frame.setSize(800,600);
frame.setVisible(true);
}
}

View File

@ -1,98 +0,0 @@
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;
/**
* This class provides an example for using visualization.DrawArea.
* @see logging.Algorithm
@author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurDrawArea extends DrawArea{
private static final long serialVersionUID = 1L;
/**
* Standard constructor.
*/
public OurDrawArea() {
super();
}
/**
* Creates a test draw area and sets the specified log list.
* @param logList the draw area's log list test log elements.
* @param drawAreaName The display name over the draw area.
*/
public OurDrawArea(LogElementList<OurLogElement> logList, String drawAreaName){
super(logList, drawAreaName);
}
/**
* Draws a visualization element.
*/
public void draw(Graphics g){
OurLogElement logElement=(OurLogElement)logList.get();
drawGraph(logElement.getGraph(), g);
}
private void drawGraph(DirectedGraph<VertexMarking, EdgeMarking> ourGraph, Graphics g) {
String convertedMarking;
/*Vector<Vertex> vertexes = new Vector<Vertex>();
for(MarkedVertex<VertexMarking> i : ourGraph.getAllVertexes()){
if(i.getMarking() != null){
convertedMarking = i.getMarking().toString();
}else{
convertedMarking = "";
}
vertexes.add(new Vertex(i.getXCoordinate(), i.getYCoordinate(), convertedMarking, Color.GRAY));
}
Vector<Edge> edges = new Vector<Edge>();
for(MarkedEdge<EdgeMarking> 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);*/
Vector<Vertex> vertexes = new Vector<Vertex>();
for(MarkedVertex<VertexMarking> i : ourGraph.getAllVertexes()){
vertexes.add(new Vertex(i.getXCoordinate(), i.getYCoordinate(), i.getName()+i.getDistance(), i.getColor()));
}
Vector<Edge> edges = new Vector<Edge>();
for(MarkedEdge<EdgeMarking> i : ourGraph.getAllEdges()){
edges.add(new Edge(i.getSource(), i.getDestination(), "i.getMarking()", Color.BLACK));
}
Graph graph = new Graph(vertexes, edges, true, EdgeStyle.Direct);
graph.draw(g);
}
}

View File

@ -1,33 +0,0 @@
package OurApplication;
import logging.LogElementList;
import visualisation.HybridWindow;
/**
* This class provides an example for using visualization.HybridWindow.
* Overwriting the constructor is necessary to run as an applet.
* For running as an application overwriting the constructor is not necessary
* @see HybridWindow
* @see OurApplication
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurHybridWindow extends HybridWindow{
/**
* Overwritten standard constructor.
* Creates a TestUpHybridWindow with
* TestParameterArea,SumUpLegendArea, TestDrawArea, TestTextArea,
* TestAlgorithm and a LogElementList of TestLogElements.
*/
public OurHybridWindow() {
super();
logList=new LogElementList<OurLogElement>();
parameterArea=new OurParameterArea();
drawArea=new OurDrawArea(logList,"visualization");
textArea=new OurTextArea(logList);
legendArea=new OurLegendArea();
algorithm=new OurAlgorithm((OurParameterArea)parameterArea);
}
}

View File

@ -1,39 +0,0 @@
package OurApplication;
import visualisation.LegendArea;
import javax.swing.*;
import java.awt.*;
/**
* This class represents a visualization.LegendArea implementation and has been created for demonstration purposes only.
* Method initialize(Graphics) is overridden and now implements logic for drawing parameters on the legend area.
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurLegendArea extends LegendArea{
private static final long serialVersionUID = 1L;
/**
* Standard constructor
*/
public OurLegendArea(){
super();
//set the legend area's preferred size manually for best visualization
setPreferredSize(new Dimension(150, 170));
}
/**
* Overridden method from super class.
* Draws all elements and descriptions on the LegendArea
* @param g the Graphics object of the corresponding panel
*/
public void initialize(Graphics g){
//Create a new TitledBorder for the LegendArea
setBorder(BorderFactory.createTitledBorder("LegendArea"));
}
}

View File

@ -1,57 +0,0 @@
package OurApplication;
import graph.DirectedGraph;
import graph.EdgeMarking;
import graph.VertexMarking;
import logging.LogElement;
/**
* This class provides an example for using logging.LogElement.
* The super class has been extended by member value and corresponding get method.
* The standard constructor has been overwritten and a new one has been introduced.
* @see LogElement
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurLogElement extends LogElement{
/** The log elements sum up value. */
protected long value;
protected DirectedGraph<VertexMarking, EdgeMarking> ourGraph;
/**
* Standard constructor.
* Calls the constructor of super class and sets value 0.
*/
public OurLogElement() {
super();
value=0;
}
/**
* Extended constructor.
* Sets specified step number, description and sum up value.
* @param step the log element's step number
* @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, DirectedGraph<VertexMarking, EdgeMarking> ourGraph){
this.step=step;
this.description=description;
this.value=value;
this.ourGraph = ourGraph;
}
/**
* Returns the log element's sum up value.
* @return the log element's sum up value
*/
public long getValue(){
return value;
}
public DirectedGraph<VertexMarking, EdgeMarking> getGraph(){
return this.ourGraph;
}
}

View File

@ -1,32 +0,0 @@
package OurApplication;
import visualisation.ParameterArea;
import javax.swing.*;
/**
* This class provides an example for using visualization.ParameterArea.
* @see ParameterArea
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurParameterArea extends ParameterArea{
private static final long serialVersionUID = 1L;
/** TextField containing maximum sum up value. */
protected JTextField maxValue;
/**
* Standard constructor.
* Creates SumUpParameterArea with an empty JTextField.
*/
public OurParameterArea() {
super();
setBorder(BorderFactory.createTitledBorder("ParameterArea"));
}
}

View File

@ -1,41 +0,0 @@
package OurApplication;
import logging.LogElementList;
import visualisation.TextArea;
/**
* This class provides an example for using visualization.TextArea.
* Constructors and print() method have been overwritten.
* @see TextArea
* @author MSch<EFBFBD>fer
* DHBW Stuttgart/Campus Horb AI2008<br>
* <br>
*/
public class OurTextArea extends TextArea{
private static final long serialVersionUID = 1L;
/**
* Standard constructor.
*/
public OurTextArea() {
super();
}
/**
* Extended constructor.
* Sets LogElementList of TestLogElements as log list.
* @param logList the text area's log element list.
*/
public OurTextArea(LogElementList<OurLogElement>logList){
super(logList);
}
/**
* Textual output of a log element.
* No output.
*/
public boolean print(){
return true;
}
}

View File

@ -1,8 +1,6 @@
package graph;
import java.awt.*;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Vector;
@ -191,227 +189,4 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
// Gibt Distanz zu gefragtem Knoten zurück
return distance.get(n2);
}
/*
public Vector<DirectedGraph> DikstraVisualization(MarkedVertex<T> n1, MarkedVertex<T> n2){
//Vektor mit einzelnen zu visualisierenden Graphen
Vector<DirectedGraph> steps = new Vector<DirectedGraph>();
// Erstellt Hashmap um Distanz von Startnoten zu jedem Knoten auf dem Graph zu tracken
// Erstellt Hashmap um zu tracken welche Knoten schon besucht wurden
// Initialisierung aller Distanzen auf UNENDLICH (= -1)
// Initialisierung, dass kein Knoten besucht wurde
HashMap<MarkedVertex<T>, Integer> distance = new HashMap<>();
HashMap<MarkedVertex<T>, Boolean> visited = new HashMap<>();
for (MarkedVertex<T> i: this.getAllVertexes()) {
distance.put(i, -1);
i.setDistance(-1);
visited.put(i, false);
i.setColor(Color.GRAY);
}
n1.setColor(Color.RED);
n1.setName("Start: ");
n2.setColor(Color.RED);
n2.setName("Ende: ");
// Erstelle Schlange wo die nächsten Verbindungen drin sind
PriorityQueue<WrapperElement<T>> queue = new PriorityQueue<>(new WrapperComparator<T>());
// Distanz zu Startknoten auf 0
// Weg zu Startknoten in die Schlange aufnehmen
distance.put(n1, 0);
n1.setDistance(0);
queue.add(new WrapperElement<>(n1, 0));
// Variable, die Distanz zwischen aktuellem Knoten und Nachfolger speichert
int dist = 0;
// Erste Visualisierung: alle Knoten grau, Start und Ende rot
DirectedGraph<T, U> initialGraph = new DirectedGraph<>();
for (MarkedVertex<T> vertex : this.getAllVertexes()) {
initialGraph.addVertex(vertex);
}
for (MarkedEdge<U> edge : this.getAllEdges()) {
initialGraph.addEdge(edge);
}
steps.add(initialGraph);
while (!queue.isEmpty()) {
// Den nächsten Knoten, der am wenigsten kostet, besuchen
WrapperElement<T> nextVertex = queue.poll();
// Knoten als besucht makieren
visited.put(nextVertex.getElement(), true);
System.out.println("Visit " + nextVertex.getElement().getName());
// Gehe von diesem Knoten aus alle erreichbaren Knoten durch
for (MarkedVertex<T> i: this.getSuccessors(nextVertex.getElement())) {
// Kante finde, die den jetzigen und nächsten Knoten verbindet
for (MarkedEdge<U> j: this.getAllEdges()) {
if (j.getSource() == nextVertex.getElement() && j.getDestination() == i) {
// Berechne Distanz zu nächstem Knoten
dist = distance.get(nextVertex.getElement()) + j.getWeighting();
break;
}
}
// Wenn es schon einen kürzeren Weg zum Knoten gibt, überspringen
if ((distance.get(i) <= dist && distance.get(i) != -1) || visited.get(i)) {
continue;
}
// Aktualisiere Distanz von Start zu nächstem Knoten
distance.put(i, dist);
System.out.println("Add " + i.getName() + " with " + dist + " weight to queue.");
// Nehme nächsten Knoten in die Queue auf
queue.add(new WrapperElement<>(i, dist));
}
}
return steps;
}
*/
public Vector<DirectedGraph<T, U>> DikstraVisualization(MarkedVertex<T> n1, MarkedVertex<T> n2) {
// Vektor mit einzelnen zu visualisierenden Graphen
Vector<DirectedGraph<T, U>> steps = new Vector<>();
// Erstellt Hashmap um Distanz von Startnoten zu jedem Knoten auf dem Graph zu tracken
// Erstellt Hashmap um zu tracken welche Knoten schon besucht wurden
// Initialisierung aller Distanzen auf UNENDLICH (= -1)
// Initialisierung, dass kein Knoten besucht wurde
HashMap<MarkedVertex<T>, Integer> distance = new HashMap<>();
HashMap<MarkedVertex<T>, Boolean> visited = new HashMap<>();
for (MarkedVertex<T> i : this.getAllVertexes()) {
distance.put(i, -1);
i.setDistance(-1);
visited.put(i, false);
i.setColor(Color.GRAY);
}
n1.setColor(Color.RED);
n1.setName("Start");
n2.setColor(Color.RED);
n2.setName("Ende");
// Erstelle Schlange wo die nächsten Verbindungen drin sind
PriorityQueue<WrapperElement<T>> queue = new PriorityQueue<>(new WrapperComparator<>());
// Distanz zu Startknoten auf 0
// Weg zu Startknoten in die Schlange aufnehmen
distance.put(n1, 0);
n1.setDistance(0);
queue.add(new WrapperElement<>(n1, 0));
// Variable, die Distanz zwischen aktuellem Knoten und Nachfolger speichert
int dist = 0;
// Erste Visualisierung: alle Knoten grau, Start und Ende rot
DirectedGraph<T, U> initialGraph = new DirectedGraph<>();
for (MarkedVertex<T> vertex : this.getAllVertexes()) {
initialGraph.addVertex(vertex);
}
for (MarkedEdge<U> edge : this.getAllEdges()) {
initialGraph.addEdge(edge);
}
steps.add(initialGraph);
while (!queue.isEmpty()) {
// Den nächsten Knoten, der am wenigsten kostet, besuchen
WrapperElement<T> nextVertex = queue.poll();
MarkedVertex<T> current = nextVertex.getElement();
// Knoten als besucht makieren
visited.put(current, true);
current.setColor(Color.BLUE); // Aktueller Knoten wird blau
// Erstelle eine Kopie des aktuellen Zustands und füge sie zu steps hinzu
DirectedGraph<T, U> visitGraph = copyGraph();
steps.add(visitGraph);
System.out.println("Visit " + current.getName());
// Gehe von diesem Knoten aus alle erreichbaren Knoten durch
for (MarkedVertex<T> i : this.getSuccessors(current)) {
if (visited.get(i)) continue; // Überspringe besuchte Knoten
// Kante finde, die den jetzigen und nächsten Knoten verbindet
for (MarkedEdge<U> j : this.getAllEdges()) {
if (j.getSource() == current && j.getDestination() == i) {
// Berechne Distanz zu nächstem Knoten
dist = distance.get(current) + j.getWeighting();
break;
}
}
// Wenn es schon einen kürzeren Weg zum Knoten gibt, überspringen
if ((distance.get(i) <= dist && distance.get(i) != -1) || visited.get(i)) {
continue;
}
// Aktualisiere Distanz von Start zu nächstem Knoten
distance.put(i, dist);
i.setDistance(dist);
System.out.println("Add " + i.getName() + " with " + dist + " weight to queue.");
// Nehme nächsten Knoten in die Queue auf
queue.add(new WrapperElement<>(i, dist));
// Setze die Farbe des Knotens in der Warteschlange auf gelb
i.setColor(Color.YELLOW);
// Erstelle eine Kopie des aktuellen Zustands und füge sie zu steps hinzu
DirectedGraph<T, U> queueGraph = copyGraph();
steps.add(queueGraph);
}
// Setze die Farbe des besuchten Knotens auf grün
current.setColor(Color.GREEN);
// Erstelle eine Kopie des aktuellen Zustands und füge sie zu steps hinzu
DirectedGraph<T, U> visitedGraph = copyGraph();
steps.add(visitedGraph);
}
return steps;
}
private DirectedGraph<T, U> copyGraph() {
DirectedGraph<T, U> newGraph = new DirectedGraph<>();
for (MarkedVertex<T> vertex : this.getAllVertexes()) {
MarkedVertex<T> newVertex = new MarkedVertex<>();
newVertex.setName(vertex.getName());
newVertex.setColor(vertex.getColor());
newVertex.setDistance(vertex.getDistance());
newVertex.setMarking(vertex.getMarking());
newVertex.setXCoordinate(vertex.getXCoordinate());
newVertex.setYCoordinate(vertex.getYCoordinate());
newGraph.addVertex(newVertex);
}
for (MarkedEdge<U> edge : this.getAllEdges()) {
MarkedEdge<U> newEdge = new MarkedEdge<>();
newEdge.setName(edge.getName());
newEdge.setMarking(edge.getMarking());
newEdge.setWeighting(edge.getWeighting());
newEdge.setSource(edge.getSource());
newEdge.setDestination(edge.getDestination());
newGraph.addEdge(newEdge);
}
return newGraph;
}
}

View File

@ -1,6 +1,5 @@
package graph;
import java.awt.*;
import java.util.Random;
public class Display {
@ -8,11 +7,10 @@ public class Display {
public static void main(String[] args) {
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
myGraph.addVertex(new MarkedVertex<>(random.nextInt(i, 350), random.nextInt(i, 350), String.valueOf(i) + " :", Color.BLACK , null));
myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null));
}
Random random = new Random();
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));

View File

@ -7,7 +7,6 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
// ATTRIBUTE
private String name;
private String description;
private Vector<MarkedVertex<T>> vertexes;
private Vector<MarkedEdge<U>> edges;
@ -32,10 +31,6 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
return this.name;
}
public String getDescription() {
return this.description;
}
public Vector<MarkedEdge<U>> getAllEdges() {
return this.edges;
@ -53,10 +48,6 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
this.name = s;
}
public void setDescription(String s) {
this.description = s;
}
// Ausgabe
public String toString() {

View File

@ -1,7 +1,5 @@
package graph;
import java.awt.*;
public class MarkedVertex<T extends VertexMarking> extends Vertex{
// ATTRIBUTE
@ -16,15 +14,15 @@ public class MarkedVertex<T extends VertexMarking> extends Vertex{
}
public MarkedVertex(int xCoordinate, int yCoordinate, String name, Color color, T t) {
super(xCoordinate, yCoordinate, name, color);
public MarkedVertex(String s, T t) {
super(s);
this.marking = t;
}
// GET-ER
/*public T getMarking() {
public T getMarking() {
return this.marking;
}
@ -33,7 +31,7 @@ public class MarkedVertex<T extends VertexMarking> extends Vertex{
public void setMarking(T t) {
this.marking = t;
}*/
}
// Ausgabe

View File

@ -1,28 +1,21 @@
package graph;
import java.awt.Color;
public abstract class Vertex extends visualizationElements.Vertex {
public abstract class Vertex {
// ATTRIBUTE
private String name;
private Color color;
private int distance;
private int xCoordinate;
private int yCoordinate;
// KONSTRUKTOREN
public Vertex() {
super(0, 0);
this.name = "";
}
public Vertex(int xCoordinate, int yCoordinate, String name, Color color) {
super(xCoordinate, yCoordinate, name, color);
public Vertex(String s) {
this.name = s;
}
@ -31,35 +24,13 @@ public abstract class Vertex extends visualizationElements.Vertex {
public String getName() {
return this.name;
}
public Color getColor() {
return this.color;
}
public int getDistance() {
return this.distance;
}
public int getXCoordinate(){
return this.xCoordinate;
}
public int getYCoordinate(){
return this.yCoordinate;
}
// SET-ER
public void setName(String s) {
this.name = s;
}
public void setColor(Color s) {
this.color = s;
}
public void setDistance(int s) {
this.distance = s;
}
public void setXCoordinate(int xCoordinate){
this.xCoordinate=xCoordinate;
}
public void setYCoordinate(int yCoordinate){
this.yCoordinate=yCoordinate;
}
}

View File

@ -1,5 +1,4 @@
package graph;
public abstract class VertexMarking extends Marking {
private String mark;
}

View File

@ -0,0 +1 @@
/out/

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ProjektGraph.iml" filepath="$PROJECT_DIR$/.idea/ProjektGraph.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/OurApplication/OurApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/OurApplication/OurDrawArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurDrawArea.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/graph/MarkedEdge.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/MarkedEdge.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 2
}</component>
<component name="ProjectId" id="2hxt4apXjGaBR1xypJAsjIrgc8R" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;Application.Display.executor&quot;: &quot;Run&quot;,
&quot;Application.OurApplication.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;Versuch__Christian&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Git/ProjektGraphMain&quot;
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Git\ProjektGraph" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="logging" />
<recent name="visualisation" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="" />
<created>1718547365327</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1718547365327</updated>
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More