Compare commits
48 Commits
Versuch_Ch
...
dc371da1f2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc371da1f2 | ||
|
|
1fe25fac02 | ||
| 6206aa8791 | |||
| 7014e9308c | |||
| deaffff595 | |||
| 5bab9b5992 | |||
|
|
d4e913b5e2 | ||
|
|
80d48d5335 | ||
|
|
e510bebc21 | ||
| 73d4a6b9aa | |||
| 3957fbba51 | |||
| f2b4876c71 | |||
|
|
8de3c54775 | ||
|
|
1313402f07 | ||
|
|
ecf2bb8656 | ||
| b5730e1b18 | |||
| e020e34d94 | |||
|
|
1f67dde5c4 | ||
|
|
72181c9a39 | ||
|
|
5e4eec4e5c | ||
| f00057ee6e | |||
| 6060796ddd | |||
| e2c2038531 | |||
| c5d2060d37 | |||
| 3629584d14 | |||
| 3c74497254 | |||
| 245fa45606 | |||
| 4e6a9902bb | |||
| ebd1173cbc | |||
| cfcb6d4d40 | |||
| 79198f4f4a | |||
| 7180d7951a | |||
| b2c8b4f54f | |||
|
|
017bbe9307 | ||
|
|
42e9ca5ec8 | ||
| e07edf8b2b | |||
|
|
e19a031a16 | ||
| 04d5175ab0 | |||
| bed270e7d2 | |||
| 58ed89d78c | |||
|
|
26bd4bbb3a | ||
|
|
e76564e204 | ||
|
|
0904358705 | ||
| 6036220c6a | |||
| 213638ad16 | |||
| 12dbadf5e1 | |||
| 6b0caa1a5e | |||
| cf63dddf51 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/out/
|
||||
/.idea/
|
||||
|
||||
112
.idea/workspace.xml
generated
112
.idea/workspace.xml
generated
@@ -4,14 +4,30 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Stable Version 3.0" />
|
||||
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Weighting gefixt">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/graph/ExampleGraphs.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/ExampleGraphs.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="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="ebd1173cbc514ede7aa65ba6be90702c92e0e8b4" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
<option name="RESET_MODE" value="HARD" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 2
|
||||
@@ -26,8 +42,9 @@
|
||||
"keyToString": {
|
||||
"Application.Display.executor": "Run",
|
||||
"Application.OurApplication.executor": "Run",
|
||||
"Application.OurLegendArea.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "Versuch__Christian",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraphMain"
|
||||
}
|
||||
@@ -58,7 +75,87 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720028543313</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<task id="LOCAL-00002" summary="Adding AStar Algorithm">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720036191925</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720036191926</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="Adding AStar Algorithm">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720036227325</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720036227325</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00004" summary="Adding AStar Algorithm">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720042374225</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720042374225</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00005" summary="Stable Version with finished visualisation">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720120737939</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720120737940</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00006" summary="Stable Version 3.0">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720182049903</created>
|
||||
<option name="number" value="00006" />
|
||||
<option name="presentableId" value="LOCAL-00006" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720182049903</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00007" summary="Tests with marking of Edges and Vertexes Adding Visualisation of Edge weight and Vertex name fixed AStar">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720291413659</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720291413659</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00008" summary="small fix">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720293774580</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720293774580</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00009" summary="Beispiele überarbeitet">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720311867957</created>
|
||||
<option name="number" value="00009" />
|
||||
<option name="presentableId" value="LOCAL-00009" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720311867957</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00010" summary="LegendArea gestaltet">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720347450647</created>
|
||||
<option name="number" value="00010" />
|
||||
<option name="presentableId" value="LOCAL-00010" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720347450647</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00011" summary="Weighting gefixt">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720362585915</created>
|
||||
<option name="number" value="00011" />
|
||||
<option name="presentableId" value="LOCAL-00011" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720362585915</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="12" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
@@ -73,7 +170,14 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Adding AStar Algorithm" />
|
||||
<MESSAGE value="Stable Version with finished visualisation" />
|
||||
<MESSAGE value="Stable Version 3.0" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Stable Version 3.0" />
|
||||
<MESSAGE value="Tests with marking of Edges and Vertexes Adding Visualisation of Edge weight and Vertex name fixed AStar" />
|
||||
<MESSAGE value="small fix" />
|
||||
<MESSAGE value="Beispiele überarbeitet" />
|
||||
<MESSAGE value="LegendArea gestaltet" />
|
||||
<MESSAGE value="Weighting gefixt" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Weighting gefixt" />
|
||||
</component>
|
||||
</project>
|
||||
117
.idea/workspace.xml.BASE
generated
Normal file
117
.idea/workspace.xml.BASE
generated
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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>
|
||||
<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">{
|
||||
"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"
|
||||
}
|
||||
}]]></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">
|
||||
<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>
|
||||
<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>
|
||||
79
.idea/workspace.xml.LOCAL
generated
Normal file
79
.idea/workspace.xml.LOCAL
generated
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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="Stable Version 3.0" />
|
||||
<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">{
|
||||
"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">{
|
||||
"keyToString": {
|
||||
"Application.Display.executor": "Run",
|
||||
"Application.OurApplication.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "Versuch__Christian",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraphMain"
|
||||
}
|
||||
}</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>
|
||||
<task id="LOCAL-00001" summary="Stable Version 3.0">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720028543313</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720028543313</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<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="Stable Version 3.0" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Stable Version 3.0" />
|
||||
</component>
|
||||
</project>
|
||||
114
.idea/workspace.xml.REMOTE
generated
Normal file
114
.idea/workspace.xml.REMOTE
generated
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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/OurDrawArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurDrawArea.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>
|
||||
<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">{
|
||||
"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">{
|
||||
"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"
|
||||
}
|
||||
}</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">
|
||||
<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>
|
||||
<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>
|
||||
100
.idea/workspace.xml.bak
generated
Normal file
100
.idea/workspace.xml.bak
generated
Normal file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<<<<<<< HEAD
|
||||
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="Stable Version 3.0" />
|
||||
=======
|
||||
<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/OurDrawArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurDrawArea.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>
|
||||
>>>>>>> 6036220c6ac166fb6e4e98d0cf9cdb5af020066a
|
||||
<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">{
|
||||
"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">{
|
||||
"keyToString": {
|
||||
<<<<<<< HEAD
|
||||
"Application.Display.executor": "Run",
|
||||
"Application.OurApplication.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "Versuch__Christian",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraphMain"
|
||||
=======
|
||||
"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"
|
||||
>>>>>>> 6036220c6ac166fb6e4e98d0cf9cdb5af020066a
|
||||
}
|
||||
}</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>
|
||||
<task id="LOCAL-00001" summary="Stable Version 3.0">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720028543313</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720028543313</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<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="Stable Version 3.0" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Stable Version 3.0" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -6,6 +6,7 @@ import logging.LogElementList;
|
||||
import visualizationElements.Vertex;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -20,6 +21,7 @@ import java.util.Vector;
|
||||
public class OurAlgorithm extends Algorithm {
|
||||
|
||||
private graph.Graph<VertexMarking, EdgeMarking> currentGraph;
|
||||
private OurMethodButtons methodButtons;
|
||||
|
||||
public OurAlgorithm() {
|
||||
super();
|
||||
@@ -28,8 +30,9 @@ public class OurAlgorithm extends Algorithm {
|
||||
* Creates a sum up algorithm.
|
||||
* @param parameterArea the sum up parameter area the algorithm gets its parameters from
|
||||
*/
|
||||
public OurAlgorithm(OurParameterArea parameterArea){
|
||||
public OurAlgorithm(OurParameterArea parameterArea, OurMethodButtons methodButtons){
|
||||
super(parameterArea,"GraphAlgorithm");
|
||||
this.methodButtons = methodButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,13 +44,37 @@ public class OurAlgorithm extends Algorithm {
|
||||
*/
|
||||
public LogElementList<OurLogElement> run() {
|
||||
|
||||
OurParameterArea currentParameterArea = (OurParameterArea) this.getParameterArea();
|
||||
this.setCurrentGraph(currentParameterArea.getSelectedGraph());
|
||||
|
||||
|
||||
MarkedVertex<VertexMarking> start = null;
|
||||
for (MarkedVertex<VertexMarking> i: this.currentGraph.getAllVertexes()) {
|
||||
if (Objects.equals(i.getName(), "Start")) {
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
|
||||
MarkedVertex<VertexMarking> end = null;
|
||||
for (MarkedVertex<VertexMarking> i: this.currentGraph.getAllVertexes()) {
|
||||
if (Objects.equals(i.getName(), "Ende")) {
|
||||
end = i;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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());
|
||||
|
||||
this.currentGraph.getShortestPathDijkstra(start, end);
|
||||
*/
|
||||
if(this.methodButtons.getSelectedMethod()){
|
||||
this.currentGraph.getShortestPathDijkstra(start, end);
|
||||
}else{
|
||||
this.currentGraph.getShortestPathAStar(start, end);
|
||||
}
|
||||
|
||||
return this.currentGraph.getLogList();
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ package OurApplication;
|
||||
import graph.*;
|
||||
import logging.LogElementList;
|
||||
import visualisation.HybridWindow;
|
||||
import visualizationElements.Vertex;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -40,13 +43,22 @@ public class OurApplication {
|
||||
*/
|
||||
public static void main(String[]args){
|
||||
|
||||
LogElementList<OurLogElement>logList = new LogElementList<OurLogElement>();
|
||||
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
|
||||
System.out.println(myGraph.toString());
|
||||
|
||||
|
||||
|
||||
LogElementList<OurLogElement> logList = new LogElementList<>();
|
||||
OurParameterArea parameterArea = new OurParameterArea();
|
||||
OurMethodButtons methodButtons = new OurMethodButtons();
|
||||
OurDrawArea drawArea = new OurDrawArea(logList,"GraphVisualization");
|
||||
OurTextArea textArea = new OurTextArea(logList);
|
||||
OurAlgorithm algorithm = new OurAlgorithm(parameterArea);
|
||||
OurAlgorithm algorithm = new OurAlgorithm(parameterArea, methodButtons);
|
||||
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);
|
||||
OurHybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea, OurMethodButtons> applet = new OurHybridWindow<>(drawArea, textArea, parameterArea, algorithm, logList, legendArea, methodButtons);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JFrame frame = new JFrame("Visualise");
|
||||
@@ -55,33 +67,8 @@ public class OurApplication {
|
||||
frame.pack();
|
||||
applet.init();
|
||||
applet.start();
|
||||
frame.setSize(800,600);
|
||||
frame.setSize(1350,800);
|
||||
frame.setVisible(true);
|
||||
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
myGraph.addVertex(new MarkedVertex<>(random.nextInt(1, 10)*40, random.nextInt(1, 10)*40, Integer.toString(i), null, Color.BLACK));
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
System.out.println(myGraph.toString());
|
||||
|
||||
drawArea.setCurrentGraph(myGraph);
|
||||
algorithm.setCurrentGraph(myGraph);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package OurApplication;
|
||||
|
||||
import graph.*;
|
||||
import graph.Graph;
|
||||
import logging.LogElementList;
|
||||
import visualisation.DrawArea;
|
||||
import visualizationElements.*;
|
||||
import visualizationElements.Edge;
|
||||
import visualizationElements.Vertex;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* This class provides an example for using visualization.DrawArea.
|
||||
@@ -21,7 +22,7 @@ public class OurDrawArea extends DrawArea{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private graph.Graph<VertexMarking, EdgeMarking> currentGraph;
|
||||
private visualizationElements.Graph currentGraph;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +42,7 @@ public class OurDrawArea extends DrawArea{
|
||||
}
|
||||
|
||||
|
||||
public void setCurrentGraph(Graph<VertexMarking, EdgeMarking> graph) {
|
||||
public void setCurrentGraph(visualizationElements.Graph graph) {
|
||||
this.currentGraph = graph;
|
||||
}
|
||||
|
||||
@@ -51,26 +52,13 @@ public class OurDrawArea extends DrawArea{
|
||||
|
||||
public void draw(Graphics g) {
|
||||
|
||||
this.currentGraph.getScreenGraph().draw(g);
|
||||
|
||||
OurLogElement logElement = (OurLogElement) logList.get();
|
||||
|
||||
if (logElement.getVertex() != null) {
|
||||
if (logElement.getVertex().getColor() == Color.BLACK) {
|
||||
logElement.getVertex().setColor(Color.YELLOW);
|
||||
} else if (logElement.getVertex().getColor() == Color.YELLOW) {
|
||||
logElement.getVertex().setColor(Color.BLUE);
|
||||
}
|
||||
} else {
|
||||
if (logElement.getEdge().getColor() == Color.BLACK) {
|
||||
logElement.getEdge().setColor(Color.YELLOW);
|
||||
} else if (logElement.getEdge().getColor() == Color.YELLOW) {
|
||||
logElement.getEdge().setColor(Color.BLUE);
|
||||
}
|
||||
this.setCurrentGraph(((OurLogElement) logList.get()).getGraph());
|
||||
logElement.getGraph().draw(g);
|
||||
for(Edge screenEdge : currentGraph.getEdges()){
|
||||
g.drawString(screenEdge.getMarking(), (screenEdge.getSource().getXpos() + screenEdge.getDestination().getXpos())/2, (screenEdge.getSource().getYpos() + screenEdge.getDestination().getYpos())/2);
|
||||
}
|
||||
|
||||
logElement.getVertex().draw(g);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
package OurApplication;
|
||||
|
||||
import logging.Algorithm;
|
||||
import logging.LogElement;
|
||||
import logging.LogElementList;
|
||||
import visualisation.HybridWindow;
|
||||
import visualisation.*;
|
||||
import visualisation.TextArea;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
|
||||
/**
|
||||
* This class provides an example for using visualization.HybridWindow.
|
||||
@@ -13,7 +25,36 @@ import visualisation.HybridWindow;
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
public class OurHybridWindow extends HybridWindow{
|
||||
public class OurHybridWindow<DRAW extends DrawArea,
|
||||
TEXT extends TextArea,
|
||||
PARAM extends ParameterArea,
|
||||
ALGORITHM extends Algorithm,
|
||||
LOG extends LogElement,
|
||||
LEGEND extends LegendArea,
|
||||
METHODBUTTONS extends ParameterArea> extends HybridWindow{
|
||||
|
||||
protected METHODBUTTONS methodButtons;
|
||||
protected StartListener startListener;
|
||||
/** Action listener for stop button. */
|
||||
protected StopListener stopListener;
|
||||
/** Action listener for previous button. */
|
||||
protected PrevListener prevListener;
|
||||
/** Action listener for next button. */
|
||||
protected NextListener nextListener;
|
||||
/** Action listener for first button. */
|
||||
protected FirstListener firstListener;
|
||||
/** Action listener for last button. */
|
||||
protected LastListener lastListener;
|
||||
/** Item listener for auto button. */
|
||||
protected AutoButtonListener autoButtonListener;
|
||||
/** Change listener for auto slider. */
|
||||
protected AutoSliderListener autoSliderListener;
|
||||
/** Item listener for forward button. */
|
||||
protected AutoForwardListener autoForwardListener;
|
||||
/** Item listener for backward button. */
|
||||
protected AutoBackwardListener autoBackwardListener;
|
||||
/** Item listener for pause button. */
|
||||
protected PauseButtonListener pauseButtonListener;
|
||||
|
||||
/**
|
||||
* Overwritten standard constructor.
|
||||
@@ -23,11 +64,245 @@ public class OurHybridWindow extends HybridWindow{
|
||||
*/
|
||||
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);
|
||||
}
|
||||
public OurHybridWindow(DRAW drawArea, TEXT textArea, PARAM parameterArea, ALGORITHM algorithm, LogElementList<LOG>logList, LEGEND legendArea, METHODBUTTONS methodButtons) {
|
||||
super(drawArea, textArea, parameterArea, algorithm, logList, legendArea);
|
||||
this.methodButtons = methodButtons;
|
||||
}
|
||||
public void init(){
|
||||
startButton=new JButton("start");
|
||||
stopButton=new JButton("stop");
|
||||
nextButton=new JButton("next");
|
||||
prevButton=new JButton("prev");
|
||||
lastButton=new JButton("last");
|
||||
firstButton=new JButton("first");
|
||||
autoButton=new JToggleButton("automatc");
|
||||
autoSlider=new JSlider(1,100,1);
|
||||
autoForwardButton=new JRadioButton("forward");
|
||||
autoBackwardButton=new JRadioButton("backward");
|
||||
pauseButton=new JButton("pause");
|
||||
|
||||
ButtonGroup autoDirection=new ButtonGroup();
|
||||
autoDirection.add(autoForwardButton);
|
||||
autoDirection.add(autoBackwardButton);
|
||||
autoForwardButton.setSelected(true);
|
||||
|
||||
JPanel panelStartStopControls=new JPanel();
|
||||
panelStartStopControls.setLayout(new GridLayout(4,1,5,5));
|
||||
panelStartStopControls.add(startButton);
|
||||
panelStartStopControls.add(stopButton);
|
||||
panelStartStopControls.add(pauseButton);
|
||||
panelStartStopControls.add(methodButtons);
|
||||
panelStartStopControls.setBorder(BorderFactory.createTitledBorder("Start / Stop"));
|
||||
|
||||
JPanel panelStepwiseExecutionControls=new JPanel();
|
||||
panelStepwiseExecutionControls.setLayout(new GridLayout(4,1,5,5));
|
||||
panelStepwiseExecutionControls.add(firstButton);
|
||||
panelStepwiseExecutionControls.add(nextButton);
|
||||
panelStepwiseExecutionControls.add(prevButton);
|
||||
panelStepwiseExecutionControls.add(lastButton);
|
||||
panelStepwiseExecutionControls.setBorder(BorderFactory.createTitledBorder("Stepwise execution"));
|
||||
|
||||
JPanel panelAutomaticExecutionControls=new JPanel();
|
||||
panelAutomaticExecutionControls.setLayout(new GridLayout(5,1,5,5));
|
||||
panelAutomaticExecutionControls.add(autoButton);
|
||||
panelAutomaticExecutionControls.add(autoSlider);
|
||||
panelAutomaticExecutionControls.add(autoForwardButton);
|
||||
panelAutomaticExecutionControls.add(autoBackwardButton);
|
||||
panelAutomaticExecutionControls.setBorder(BorderFactory.createTitledBorder("Automatic execution"));
|
||||
|
||||
JPanel buttonLine=new JPanel();
|
||||
buttonLine.setLayout(new GridLayout(3,1,5,5));
|
||||
buttonLine.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
buttonLine.add(panelStartStopControls);
|
||||
buttonLine.add(panelStepwiseExecutionControls);
|
||||
buttonLine.add(panelAutomaticExecutionControls);
|
||||
|
||||
JLabel headline=new JLabel(algorithm.getTitle());
|
||||
headline.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
||||
headline.setFont(new Font("SansSerif",Font.PLAIN,20));
|
||||
|
||||
JScrollPane parameterAreaScrollPane = parameterArea.getScrollPane();
|
||||
JScrollPane legendAreaScrollPane = legendArea.getScrollPane();
|
||||
|
||||
parameterAreaScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
legendAreaScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
JSplitPane hybridWindowSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,parameterAreaScrollPane, legendAreaScrollPane);
|
||||
hybridWindowSplitPane.setOneTouchExpandable(true);
|
||||
hybridWindowSplitPane.setResizeWeight(0.465);
|
||||
tabbedPane.insertTab(drawArea.getDrawAreaName(),null, drawArea.getScrollPane(),drawArea.getDrawAreaName(),0);
|
||||
tabbedPane.setSelectedIndex(0);
|
||||
|
||||
setLayout(new BorderLayout(10,10));
|
||||
|
||||
add(headline,BorderLayout.NORTH);
|
||||
add(hybridWindowSplitPane,BorderLayout.WEST);
|
||||
add(tabbedPane,BorderLayout.CENTER);
|
||||
add(textArea.getScrollPane(),BorderLayout.SOUTH);
|
||||
add(buttonLine,BorderLayout.EAST);
|
||||
|
||||
setState(PARAMETERSTATE);
|
||||
|
||||
startListener= new StartListener();
|
||||
stopListener=new StopListener();
|
||||
prevListener=new PrevListener();
|
||||
nextListener=new NextListener();
|
||||
firstListener=new FirstListener();
|
||||
lastListener=new LastListener();
|
||||
autoButtonListener=new AutoButtonListener();
|
||||
autoSliderListener=new AutoSliderListener();
|
||||
autoForwardListener=new AutoForwardListener();
|
||||
autoBackwardListener=new AutoBackwardListener();
|
||||
pauseButtonListener=new PauseButtonListener();
|
||||
|
||||
startButton.addActionListener(startListener);
|
||||
stopButton.addActionListener(stopListener);
|
||||
prevButton.addActionListener(prevListener);
|
||||
nextButton.addActionListener(nextListener);
|
||||
firstButton.addActionListener(firstListener);
|
||||
lastButton.addActionListener(lastListener);
|
||||
autoButton.addItemListener(autoButtonListener);
|
||||
autoSlider.addChangeListener(autoSliderListener);
|
||||
autoForwardButton.addItemListener(autoForwardListener);
|
||||
autoBackwardButton.addItemListener(autoBackwardListener);
|
||||
pauseButton.addActionListener(pauseButtonListener);
|
||||
|
||||
autoTimer=new Timer(1,nextListener);
|
||||
}
|
||||
|
||||
class StartListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
Component[]bComponents=methodButtons.getComponents();
|
||||
setState(RUNSTATE);
|
||||
for(Component c:bComponents){
|
||||
c.setEnabled(false);
|
||||
}
|
||||
logList=algorithm.run();
|
||||
drawArea.setLogList(logList);
|
||||
textArea.setLogList(logList);
|
||||
}
|
||||
}
|
||||
|
||||
class StopListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
Component[]bComponents=methodButtons.getComponents();
|
||||
setState(PARAMETERSTATE);
|
||||
for(Component c:bComponents){
|
||||
c.setEnabled(true);
|
||||
}
|
||||
logList.clear();
|
||||
drawArea.clear();
|
||||
textArea.clear();
|
||||
}
|
||||
}
|
||||
|
||||
class PrevListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
if(logList.isInitialized()){
|
||||
if(logList.get()==logList.firstElement()){
|
||||
autoButton.setSelected(false);
|
||||
}
|
||||
else{
|
||||
logList.prev();
|
||||
drawArea.drawStep();
|
||||
textArea.printStep();
|
||||
}
|
||||
}
|
||||
else{
|
||||
logList.prev();
|
||||
drawArea.drawStep();
|
||||
textArea.printStep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NextListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
if(logList.isInitialized()){
|
||||
if(logList.get()==logList.lastElement()){
|
||||
autoButton.setSelected(false);
|
||||
}
|
||||
else{
|
||||
logList.next();
|
||||
drawArea.drawStep();
|
||||
textArea.printStep();
|
||||
}
|
||||
}
|
||||
else{
|
||||
logList.next();
|
||||
drawArea.drawStep();
|
||||
textArea.printStep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FirstListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
logList.first();
|
||||
drawArea.drawStep();
|
||||
textArea.printStep();
|
||||
}
|
||||
}
|
||||
|
||||
class LastListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
logList.last();
|
||||
drawArea.drawStep();
|
||||
textArea.printStep();
|
||||
}
|
||||
}
|
||||
|
||||
class AutoButtonListener implements ItemListener {
|
||||
public void itemStateChanged(ItemEvent event){
|
||||
if(event.getStateChange()==ItemEvent.SELECTED){
|
||||
setState(AUTOSTATE);
|
||||
autoTimer.setDelay(10000/((int)Math.pow(autoSlider.getValue(),2)));
|
||||
autoTimer.start();
|
||||
}else{
|
||||
setState(RUNSTATE);
|
||||
autoTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AutoSliderListener implements ChangeListener {
|
||||
public void stateChanged(ChangeEvent event){
|
||||
if(autoTimer.isRunning()){
|
||||
autoTimer.stop();
|
||||
autoTimer.setInitialDelay(10000/((int)Math.pow(autoSlider.getValue(),2)));
|
||||
autoTimer.setDelay(10000/((int)Math.pow(autoSlider.getValue(),2)));
|
||||
autoTimer.start();
|
||||
autoTimer.setInitialDelay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AutoForwardListener implements ItemListener{
|
||||
public void itemStateChanged(ItemEvent event){
|
||||
if(event.getStateChange()==ItemEvent.SELECTED){
|
||||
autoTimer.removeActionListener(prevListener);
|
||||
autoTimer.addActionListener(nextListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AutoBackwardListener implements ItemListener{
|
||||
public void itemStateChanged(ItemEvent event){
|
||||
if(event.getStateChange()==ItemEvent.SELECTED){
|
||||
autoTimer.removeActionListener(nextListener);
|
||||
autoTimer.addActionListener(prevListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PauseButtonListener implements ActionListener{
|
||||
public void actionPerformed(ActionEvent event){
|
||||
if(autoButton.isSelected()){
|
||||
setState(RUNSTATE);
|
||||
autoTimer.stop();
|
||||
autoButton.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,47 @@ public class OurLegendArea extends LegendArea{
|
||||
* 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"));
|
||||
public void initialize(Graphics g) {
|
||||
|
||||
// Erstellt einen neuen TitledBorder für den Legendenbereich
|
||||
setBorder(BorderFactory.createTitledBorder("LegendArea"));
|
||||
|
||||
// Zeichnet den roten Knoten (Start/End Knoten)
|
||||
int y = 30; // Startposition für das Zeichnen der Legenden-Elemente
|
||||
g.setColor(Color.RED);
|
||||
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
|
||||
g.drawString("Start/End Knoten", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
|
||||
|
||||
// Zeichnet den blauen Knoten (Besuchter Knoten)
|
||||
y += 40; // Nach unten verschieben für das nächste Element
|
||||
g.setColor(Color.BLUE);
|
||||
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
|
||||
g.drawString("Besuchter Knoten", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
|
||||
|
||||
// Zeichnet den gelben Knoten (Erreichbare Knoten)
|
||||
y += 40; // Nach unten verschieben für das nächste Element
|
||||
g.setColor(Color.YELLOW);
|
||||
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
|
||||
g.drawString("Erreichbare Knoten", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
|
||||
|
||||
// Zeichnet den grünen Knoten (Fertiger Weg)
|
||||
y += 40; // Nach unten verschieben für das nächste Element
|
||||
g.setColor(Color.green);
|
||||
g.fillOval(10, y, 20, 20); // Zeichnet einen kleinen Kreis (Knoten) mit der Farbe des Elements
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawOval(10, y, 20, 20); // Zeichnet den Rand des Kreises
|
||||
g.drawString("Fertiger Weg", 40, y + 15); // Zeichnet die Beschreibung neben dem Kreis
|
||||
|
||||
// Zeichnet die schwarze Linie (Kanten Markierung)
|
||||
y += 40; // Nach unten verschieben für das nächste Element
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawLine(10, y + 10, 30, y + 10); // Zeichnet eine horizontale Linie
|
||||
g.drawString("Kanten Markierung", 40, y + 15); // Zeichnet die Beschreibung neben der Linie
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public class OurLogElement extends LogElement{
|
||||
protected long value;
|
||||
protected Vertex vertex;
|
||||
protected Edge edge;
|
||||
protected visualizationElements.Graph ourGraph;
|
||||
|
||||
/**
|
||||
* Standard constructor.
|
||||
@@ -39,19 +40,27 @@ 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, Vertex v){
|
||||
public OurLogElement(int step, String description, long value, Vertex vertex){
|
||||
this.step = step;
|
||||
this.description = description;
|
||||
this.value = value;
|
||||
this.vertex = v;
|
||||
this.vertex = vertex;
|
||||
}
|
||||
|
||||
|
||||
public OurLogElement(int step, String description, long value, Edge e){
|
||||
public OurLogElement(int step, String description, long value, Edge edge){
|
||||
this.step = step;
|
||||
this.description = description;
|
||||
this.value = value;
|
||||
this.edge = e;
|
||||
this.edge = edge;
|
||||
}
|
||||
|
||||
|
||||
public OurLogElement(int step, String description, long value, visualizationElements.Graph ourGraph ){
|
||||
this.step = step;
|
||||
this.description = description;
|
||||
this.value = value;
|
||||
this.ourGraph = ourGraph;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,4 +80,9 @@ public class OurLogElement extends LogElement{
|
||||
public Vertex getVertex() {
|
||||
return this.vertex;
|
||||
}
|
||||
|
||||
|
||||
public visualizationElements.Graph getGraph() {
|
||||
return this.ourGraph;
|
||||
}
|
||||
}
|
||||
|
||||
73
OurApplication/OurMethodButtons.java
Normal file
73
OurApplication/OurMethodButtons.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package OurApplication;
|
||||
|
||||
import visualisation.ParameterArea;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* This class provides an example for using visualization.ParameterArea.
|
||||
* @see ParameterArea
|
||||
* @author MSch<63>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
public class OurMethodButtons extends ParameterArea{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected JRadioButton button1;
|
||||
protected JRadioButton button2;
|
||||
private boolean isDjikstra;
|
||||
|
||||
|
||||
/** TextField containing maximum sum up value. */
|
||||
protected JTextField maxValue;
|
||||
|
||||
/**
|
||||
* Standard constructor.
|
||||
* Creates SumUpMethodArea with an empty JTextField.
|
||||
*/
|
||||
public OurMethodButtons() {
|
||||
super();
|
||||
|
||||
isDjikstra = true; // Standardmäßig Djikstra
|
||||
|
||||
// Layout-Manager setzen, um die Buttons vertikal anzuordnen
|
||||
setLayout(new GridLayout(1, 2, 5, 5)); // 1 Zeile, 2 Spalten, 5 Pixel Abstand
|
||||
|
||||
// Buttons erstellen
|
||||
button1 = new JRadioButton("Djikstra", true);
|
||||
button2 = new JRadioButton("A-Stern");
|
||||
|
||||
// ButtonGroup erstellen und Buttons hinzufügen, um die gegenseitige Ausschließung zu gewährleisten
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(button1);
|
||||
group.add(button2);
|
||||
|
||||
// ActionListener hinzufügen
|
||||
button1.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
isDjikstra = true;
|
||||
}
|
||||
});
|
||||
|
||||
button2.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
isDjikstra = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Buttons zum Panel hinzufügen
|
||||
this.add(button1);
|
||||
this.add(button2);
|
||||
}
|
||||
|
||||
public boolean getSelectedMethod() {
|
||||
return isDjikstra;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package OurApplication;
|
||||
|
||||
import graph.*;
|
||||
import visualisation.ParameterArea;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* This class provides an example for using visualization.ParameterArea.
|
||||
@@ -14,7 +18,23 @@ import javax.swing.*;
|
||||
public class OurParameterArea extends ParameterArea{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private DirectedGraph<VertexMarking, EdgeMarking> customGraph;
|
||||
|
||||
private JRadioButton button1;
|
||||
private JRadioButton button2;
|
||||
private JRadioButton button3;
|
||||
private JRadioButton button4;
|
||||
private JRadioButton button5;
|
||||
|
||||
private JButton buttonAddGraph;
|
||||
private JTextField textField1;
|
||||
private JTextField textField2;
|
||||
|
||||
|
||||
private int selectedExample;
|
||||
|
||||
|
||||
/** TextField containing maximum sum up value. */
|
||||
protected JTextField maxValue;
|
||||
|
||||
@@ -24,8 +44,112 @@ public class OurParameterArea extends ParameterArea{
|
||||
*/
|
||||
public OurParameterArea() {
|
||||
super();
|
||||
selectedExample = 1; // Standardmäßig Beispiel 1
|
||||
this.customGraph = new DirectedGraph<>();
|
||||
|
||||
setBorder(BorderFactory.createTitledBorder("ParameterArea"));
|
||||
|
||||
// Hier Elemente adden
|
||||
// Layout-Manager setzen, um die Buttons vertikal anzuordnen
|
||||
setLayout(new GridLayout(4, 1, 5, 5)); // 4 Zeilen, 1 Spalte, 5 Pixel Abstand
|
||||
|
||||
// Buttons erstellen
|
||||
button1 = new JRadioButton("Beispiel 1", true);
|
||||
button2 = new JRadioButton("Beispiel 2");
|
||||
button3 = new JRadioButton("Beispiel 3");
|
||||
button4 = new JRadioButton("Beispiel 4");
|
||||
button5 = new JRadioButton("Eigener Graph");
|
||||
|
||||
buttonAddGraph = new JButton("Graph einfügen");
|
||||
// Eingabefelder
|
||||
textField1 = new JTextField("Knoten");
|
||||
textField2 = new JTextField("Kanten");
|
||||
|
||||
|
||||
// ButtonGroup erstellen und Buttons hinzufügen, um die gegenseitige Ausschließung zu gewährleisten
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(button1);
|
||||
group.add(button2);
|
||||
group.add(button3);
|
||||
group.add(button4);
|
||||
group.add(button5);
|
||||
|
||||
// ActionListener hinzufügen
|
||||
button1.addActionListener(e -> selectedExample = 1);
|
||||
|
||||
button2.addActionListener(e -> selectedExample = 2);
|
||||
|
||||
button3.addActionListener(e -> selectedExample = 3);
|
||||
|
||||
button4.addActionListener(e -> selectedExample = 4);
|
||||
|
||||
button5.addActionListener(e -> selectedExample = 5);
|
||||
|
||||
|
||||
buttonAddGraph.addActionListener(e -> {
|
||||
String input1 = textField1.getText();
|
||||
String input2 = textField2.getText();
|
||||
this.customGraph = createGraph(input1, input2);
|
||||
});
|
||||
|
||||
// Buttons zum Panel hinzufügen
|
||||
add(button1);
|
||||
add(button2);
|
||||
add(button3);
|
||||
add(button4);
|
||||
add(button5);
|
||||
|
||||
add(buttonAddGraph);
|
||||
add(textField1);
|
||||
add(textField2);
|
||||
}
|
||||
|
||||
public DirectedGraph<VertexMarking, EdgeMarking> getSelectedGraph() {
|
||||
ExampleGraphs temp = new ExampleGraphs();
|
||||
switch (selectedExample) {
|
||||
case 2:
|
||||
return temp.example2();
|
||||
case 3:
|
||||
return temp.example3();
|
||||
case 4:
|
||||
return temp.example4();
|
||||
case 5:
|
||||
return this.customGraph;
|
||||
case 1:
|
||||
default:
|
||||
return temp.example1();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Vertex Eingabe: A-23-23;A-23-23
|
||||
// Edge Eingabe: A-B-15;A-B-15
|
||||
public DirectedGraph<VertexMarking, EdgeMarking> createGraph(String vertices, String edges) {
|
||||
DirectedGraph<VertexMarking, EdgeMarking> newGraph = new DirectedGraph<>();
|
||||
|
||||
|
||||
String[] allVertices = vertices.split(";");
|
||||
String[] allEdges = edges.split(";");
|
||||
|
||||
for (String i: allVertices) {
|
||||
String[] current = i.split("-");
|
||||
newGraph.addVertex(new MarkedVertex<>(Integer.parseInt(current[1]), Integer.parseInt(current[2]), current[0], null, Color.BLACK));
|
||||
}
|
||||
|
||||
MarkedVertex<VertexMarking> start = null;
|
||||
MarkedVertex<VertexMarking> end = null;
|
||||
for (String i: allEdges) {
|
||||
String[] current = i.split("-");
|
||||
for (MarkedVertex<VertexMarking> j: newGraph.getAllVertexes()) {
|
||||
if (j.getName() == current[0]) {
|
||||
start = j;
|
||||
} else if (j.getName() == current[1]) {
|
||||
end = j;
|
||||
}
|
||||
}
|
||||
newGraph.addEdge(new MarkedEdge<>(i, start, end, new EdgeWeightMarking(Integer.parseInt(current[2]))));
|
||||
}
|
||||
|
||||
return newGraph;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package OurApplication;
|
||||
|
||||
import logging.LogElement;
|
||||
import logging.LogElementList;
|
||||
import visualisation.TextArea;
|
||||
|
||||
@@ -36,6 +37,8 @@ public class OurTextArea extends TextArea{
|
||||
* No output.
|
||||
*/
|
||||
public boolean print(){
|
||||
LogElement logElement=(LogElement)logList.get();
|
||||
setText(logElement.getDescription());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
package graph;
|
||||
|
||||
import OurApplication.OurAlgorithm;
|
||||
import OurApplication.OurLogElement;
|
||||
import logging.LogElementList;
|
||||
import visualizationElements.Edge;
|
||||
import visualizationElements.EdgeStyle;
|
||||
import visualizationElements.Vertex;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a directed graph with vertex and edge markings. This class extends the Graph class and
|
||||
* provides additional functionality for directed graphs, including visualization and logging capabilities.
|
||||
*
|
||||
* @param <T> the type of vertex marking
|
||||
* @param <U> the type of edge marking
|
||||
*/
|
||||
public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> extends Graph<T, U> {
|
||||
|
||||
// ATTRIBUTE
|
||||
@@ -23,6 +30,9 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
|
||||
// KONSTRUKTOREN
|
||||
|
||||
/**
|
||||
* Constructs an empty directed graph.
|
||||
*/
|
||||
public DirectedGraph() {
|
||||
super();
|
||||
this.screenGraph = new visualizationElements.Graph(new Vector<Vertex>(), new Vector<Edge>(), true, EdgeStyle.Direct);
|
||||
@@ -30,6 +40,11 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a directed graph from a string representation.
|
||||
*
|
||||
* @param s the string representation of the graph
|
||||
*/
|
||||
public DirectedGraph(String s) {
|
||||
super(s);
|
||||
this.screenGraph = new visualizationElements.Graph(new Vector<Vertex>(), new Vector<Edge>(), true, EdgeStyle.Direct);
|
||||
@@ -39,11 +54,44 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Returns the screen graph associated with this directed graph.
|
||||
*
|
||||
* @return the screen graph
|
||||
*/
|
||||
public visualizationElements.Graph getScreenGraph() {
|
||||
return this.screenGraph;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a copy of the screen graph associated with this directed graph.
|
||||
*
|
||||
* @return a copy of the screen graph
|
||||
*/
|
||||
public visualizationElements.Graph getScreenGraphCopy() {
|
||||
visualizationElements.Graph graphCopy = new visualizationElements.Graph(new Vector<Vertex>(), new Vector<Edge>(), true, EdgeStyle.Direct);
|
||||
Vector<visualizationElements.Vertex> copiedVertexes = new Vector<>();
|
||||
Vector<visualizationElements.Edge> copiedEdges = new Vector<>();
|
||||
for (visualizationElements.Vertex vertexCopy : this.screenGraph.getVertexes()) {
|
||||
visualizationElements.Vertex newCopiedVertex = new visualizationElements.Vertex(vertexCopy.getXpos(), vertexCopy.getYpos(), vertexCopy.getMarking(), vertexCopy.getColor());
|
||||
copiedVertexes.add(newCopiedVertex);
|
||||
graphCopy.setVertexes(copiedVertexes);
|
||||
}
|
||||
for (visualizationElements.Edge edgeCopy : this.screenGraph.getEdges()) {
|
||||
visualizationElements.Edge newCopiedEdge = new visualizationElements.Edge(edgeCopy.getSource(), edgeCopy.getDestination(), edgeCopy.getMarking(), edgeCopy.getColor());
|
||||
copiedEdges.add(newCopiedEdge);
|
||||
graphCopy.setEdges(copiedEdges);
|
||||
}
|
||||
return graphCopy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the log list associated with this directed graph.
|
||||
*
|
||||
* @return the log list
|
||||
*/
|
||||
public LogElementList<OurLogElement> getLogList() {
|
||||
return this.logList;
|
||||
}
|
||||
@@ -51,14 +99,22 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
|
||||
// HINZUFÜGEN
|
||||
|
||||
// Kante hinzufügen
|
||||
/**
|
||||
* Adds an edge to the graph.
|
||||
*
|
||||
* @param e the edge to be added
|
||||
*/
|
||||
public void addEdge(MarkedEdge<U> e) {
|
||||
super.addEdge(e);
|
||||
this.screenGraph.getEdges().add(e.getScreenEdge());
|
||||
}
|
||||
|
||||
|
||||
// Knoten hinzufügen
|
||||
/**
|
||||
* Adds a vertex to the graph.
|
||||
*
|
||||
* @param n the vertex to be added
|
||||
*/
|
||||
public void addVertex(MarkedVertex<T> n) {
|
||||
super.addVertex(n);
|
||||
this.screenGraph.getVertexes().add(n.getScreenVertex());
|
||||
@@ -67,14 +123,22 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
|
||||
// LÖSCHEN
|
||||
|
||||
// Kante löschen
|
||||
/**
|
||||
* Removes an edge from the graph.
|
||||
*
|
||||
* @param e the edge to be removed
|
||||
*/
|
||||
public void removeEdge(MarkedEdge<U> e) {
|
||||
super.removeEdge(e);
|
||||
this.screenGraph.getEdges().remove(e.getScreenEdge());
|
||||
}
|
||||
|
||||
|
||||
// Knoten löschen
|
||||
/**
|
||||
* Removes a vertex from the graph.
|
||||
*
|
||||
* @param n the vertex to be removed
|
||||
*/
|
||||
public void removeVertex(MarkedVertex<T> n) {
|
||||
super.removeVertex(n);
|
||||
this.screenGraph.getVertexes().remove(n.getScreenVertex());
|
||||
@@ -83,7 +147,13 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
|
||||
// KNOTEN EIGENSCHAFTEN
|
||||
|
||||
// Prüfung, ob zwei Knoten stark adjazent sind
|
||||
/**
|
||||
* Checks if two vertices are strongly adjacent (i.e., there is a bidirectional edge between them).
|
||||
*
|
||||
* @param n1 the first vertex
|
||||
* @param n2 the second vertex
|
||||
* @return true if the vertices are strongly adjacent, false otherwise
|
||||
*/
|
||||
public boolean areStrongAdjacent(MarkedVertex<T> n1, MarkedVertex<T> n2) {
|
||||
boolean n1ton2 = false;
|
||||
boolean n2ton1 = false;
|
||||
@@ -98,6 +168,14 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if two vertices are strongly adjacent (i.e., there is a bidirectional edge between them) by their names.
|
||||
*
|
||||
* @param s1 the name of the first vertex
|
||||
* @param s2 the name of the second vertex
|
||||
* @return true if the vertices are strongly adjacent, false otherwise
|
||||
* @throws NameDoesNotExistException if one of the vertices does not exist
|
||||
*/
|
||||
public boolean areStrongAdjacent(String s1, String s2) throws NameDoesNotExistException {
|
||||
MarkedVertex<T> n1 = null;
|
||||
MarkedVertex<T> n2 = null;
|
||||
@@ -116,7 +194,12 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
// Prüfung des Eingangsgrades eines Knotens
|
||||
/**
|
||||
* Returns the in-degree of a vertex (i.e., the number of edges directed towards the vertex).
|
||||
*
|
||||
* @param n the vertex
|
||||
* @return the in-degree of the vertex
|
||||
*/
|
||||
public int inDegree(MarkedVertex<T> n) {
|
||||
int degree = 0;
|
||||
for (MarkedEdge<U> i: this.getAllEdges()) {
|
||||
@@ -128,6 +211,13 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the in-degree of a vertex by its name.
|
||||
*
|
||||
* @param s the name of the vertex
|
||||
* @return the in-degree of the vertex
|
||||
* @throws NameDoesNotExistException if the vertex does not exist
|
||||
*/
|
||||
public int inDegree(String s) throws NameDoesNotExistException{
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
@@ -138,7 +228,12 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
// Prüfung des Ausgangsgrades eines Knotens
|
||||
/**
|
||||
* Returns the out-degree of a vertex (i.e., the number of edges directed away from the vertex).
|
||||
*
|
||||
* @param n the vertex
|
||||
* @return the out-degree of the vertex
|
||||
*/
|
||||
public int outDegree(MarkedVertex<T> n) {
|
||||
int degree = 0;
|
||||
for (MarkedEdge<U> i: this.getAllEdges()) {
|
||||
@@ -150,6 +245,13 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the out-degree of a vertex by its name.
|
||||
*
|
||||
* @param s the name of the vertex
|
||||
* @return the out-degree of the vertex
|
||||
* @throws NameDoesNotExistException if the vertex does not exist
|
||||
*/
|
||||
public int outDegree(String s) throws NameDoesNotExistException{
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
@@ -160,7 +262,12 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, welche Knoten Vorgänger sind
|
||||
/**
|
||||
* Returns a vector of predecessor vertices (i.e., vertices with edges directed towards the specified vertex).
|
||||
*
|
||||
* @param n the vertex
|
||||
* @return a vector of predecessor vertices
|
||||
*/
|
||||
public Vector<MarkedVertex<T>> getPredecessors(MarkedVertex<T> n) {
|
||||
Vector<MarkedVertex<T>> predecessors = new Vector<>();
|
||||
for (MarkedEdge<U> i: this.getAllEdges()) {
|
||||
@@ -172,7 +279,12 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, welche Knoten Nachfolger sind
|
||||
/**
|
||||
* Returns a vector of successor vertices (i.e., vertices with edges directed away from the specified vertex).
|
||||
*
|
||||
* @param n the vertex
|
||||
* @return a vector of successor vertices
|
||||
*/
|
||||
public Vector<MarkedVertex<T>> getSuccessors(MarkedVertex<T> n) {
|
||||
Vector<MarkedVertex<T>> successors = new Vector<>();
|
||||
for (MarkedEdge<U> i: this.getAllEdges()) {
|
||||
@@ -186,18 +298,28 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
|
||||
// AUFGABE 2
|
||||
|
||||
// Dijkstra-Algorithmus
|
||||
/**
|
||||
* Finds the shortest path between two vertices using Dijkstra's algorithm.
|
||||
*
|
||||
* @param n1 the starting vertex
|
||||
* @param n2 the ending vertex
|
||||
* @return the shortest distance from n1 to n2, or -1 if no path is found
|
||||
*/
|
||||
public int getShortestPathDijkstra(MarkedVertex<T> n1, MarkedVertex<T> n2) {
|
||||
|
||||
// Erstellt Hashmap um Distanz von Startnoten zu jedem Knoten auf dem Graph zu tracken
|
||||
// Erstellt Hashmap um zu tracken welche Knoten schon besucht wurden
|
||||
// Erstelle Hashmap um Vorgängerknoten zu tracken
|
||||
// Initialisierung aller Distanzen auf UNENDLICH (= -1)
|
||||
// Initialisierung, dass kein Knoten besucht wurde
|
||||
// Initialisierung aller Vorgänger auf null
|
||||
HashMap<MarkedVertex<T>, Integer> distance = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, Boolean> visited = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, MarkedVertex<T>> predecessors = new HashMap<>();
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
distance.put(i, -1);
|
||||
visited.put(i, false);
|
||||
predecessors.put(i, null);
|
||||
}
|
||||
|
||||
// Erstelle Schlange wo die nächsten Verbindungen drin sind
|
||||
@@ -212,19 +334,51 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
int dist = 0;
|
||||
// Zähler für LogList
|
||||
int step = 0;
|
||||
visualizationElements.Graph display;
|
||||
// String für den Description Inhalt
|
||||
String textDescription;
|
||||
|
||||
// Färben der Start und Ziel Knoten für Visualisierung + hinzufügen zur LogList
|
||||
n1.getScreenVertex().setColor(Color.RED);
|
||||
n2.getScreenVertex().setColor(Color.RED);
|
||||
textDescription = "Startknoten: " + n1.getScreenVertex().getMarking()
|
||||
+ ", Endknoten: " + n2.getScreenVertex().getMarking();
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
|
||||
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);
|
||||
// Falls Knoten schon besucht
|
||||
if(!visited.get(nextVertex.getElement())){
|
||||
// Knoten als besucht makieren
|
||||
visited.put(nextVertex.getElement(), true);
|
||||
textDescription = "Visit " + nextVertex.getElement().getName();
|
||||
// Logging
|
||||
System.out.println(textDescription);
|
||||
if (nextVertex.getElement().getScreenVertex().getColor() != Color.RED) {
|
||||
nextVertex.getElement().getScreenVertex().setColor(Color.BLUE);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}
|
||||
|
||||
// Wenn Weg gefunden, brich ab
|
||||
if (nextVertex.getElement() == n2) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
// Logging
|
||||
System.out.println("Visit " + nextVertex.getElement().getName());
|
||||
this.logList.add(new OurLogElement(step, "Step: " + step, 0, nextVertex.getElement().getScreenVertex()));
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
return distance.get(n2);
|
||||
}
|
||||
|
||||
|
||||
// Gehe von diesem Knoten aus alle erreichbaren Knoten durch
|
||||
@@ -235,7 +389,8 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
if (j.getSource() == nextVertex.getElement() && j.getDestination() == i) {
|
||||
|
||||
// Berechne Distanz zu nächstem Knoten
|
||||
dist = distance.get(nextVertex.getElement()) + j.getWeighting();
|
||||
EdgeWeightMarking marking = (EdgeWeightMarking) j.getMarking();
|
||||
dist = distance.get(nextVertex.getElement()) + marking.getWeight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -245,18 +400,187 @@ public class DirectedGraph<T extends VertexMarking, U extends EdgeMarking> exten
|
||||
continue;
|
||||
}
|
||||
|
||||
// Vorgänger aktualisieren
|
||||
predecessors.put(i, nextVertex.getElement());
|
||||
|
||||
// Aktualisiere Distanz von Start zu nächstem Knoten
|
||||
distance.put(i, dist);
|
||||
|
||||
// Logging
|
||||
System.out.println("Add " + i.getName() + " with " + dist + " weight to queue.");
|
||||
this.logList.add(new OurLogElement(step, "Step: " + step, 0, nextVertex.getElement().getScreenVertex()));
|
||||
textDescription = "Add " + i.getName() + " with " + dist + " weight to queue.";
|
||||
System.out.println(textDescription);
|
||||
if (i.getScreenVertex().getColor() != Color.RED) {
|
||||
i.getScreenVertex().setColor(Color.YELLOW);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
// Nehme nächsten Knoten in die Queue auf
|
||||
queue.add(new WrapperElement<>(i, dist));
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the shortest path between two vertices using the A* algorithm.
|
||||
*
|
||||
* @param n1 the starting vertex
|
||||
* @param n2 the ending vertex
|
||||
* @return the shortest distance from n1 to n2, or -1 if no path is found
|
||||
*/
|
||||
public double getShortestPathAStar(MarkedVertex<T> n1, MarkedVertex<T> n2) {
|
||||
|
||||
// Erstellt Hashmap um Distanz von Startnoten zu jedem Knoten auf dem Graph zu tracken
|
||||
// Erstellt Hashmap um zu tracken welche Knoten schon besucht wurden
|
||||
// Erstelle Hashmap um Vorgängerknoten zu tracken
|
||||
// Initialisierung aller Distanzen auf UNENDLICH (= -1)
|
||||
// Initialisierung, dass kein Knoten besucht wurde
|
||||
// Initialisierung aller Vorgänger auf null
|
||||
HashMap<MarkedVertex<T>, Double> distance = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, Boolean> visited = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, MarkedVertex<T>> predecessors = new HashMap<>();
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
distance.put(i, -1.0);
|
||||
visited.put(i, false);
|
||||
predecessors.put(i, null);
|
||||
}
|
||||
|
||||
// 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.0);
|
||||
queue.add(new WrapperElement<>(n1, 0));
|
||||
|
||||
// Variable, die Distanz zwischen aktuellem Knoten und Nachfolger speichert
|
||||
double dist = 0;
|
||||
// Variable, die Distanz zwischen dem potenziell nächsten Knoten und dem Zielknoten speichert
|
||||
double airDist = 0;
|
||||
// Variable, die Distanz zwischen dem aktuellen Knoten bis zum Endknoten speichert
|
||||
double distToFinish = 0;
|
||||
// Zähler für LogList
|
||||
int step = 0;
|
||||
// String für den Description Inhalt
|
||||
String textDescription;
|
||||
|
||||
// Färben der Start und Ziel Knoten für Visualisierung + hinzufügen zur LogList
|
||||
n1.getScreenVertex().setColor(Color.RED);
|
||||
n2.getScreenVertex().setColor(Color.RED);
|
||||
textDescription = "Startknoten: " + n1.getScreenVertex().getMarking()
|
||||
+ ", Endknoten: " + n2.getScreenVertex().getMarking();
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
// Den nächsten Knoten, der am wenigsten kostet, besuchen
|
||||
WrapperElement<T> nextVertex = queue.poll();
|
||||
|
||||
|
||||
// Falls Knoten schon besucht
|
||||
if(!visited.get(nextVertex.getElement())){
|
||||
// Knoten als besucht makieren
|
||||
visited.put(nextVertex.getElement(), true);
|
||||
textDescription = "Visit " + nextVertex.getElement().getName();
|
||||
// Logging
|
||||
System.out.println(textDescription);
|
||||
if (nextVertex.getElement().getScreenVertex().getColor() != Color.RED) {
|
||||
nextVertex.getElement().getScreenVertex().setColor(Color.BLUE);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}
|
||||
|
||||
// Wenn Weg gefunden, brich ab
|
||||
if (nextVertex.getElement() == n2) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
return distance.get(n2);
|
||||
}
|
||||
|
||||
|
||||
// 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) {
|
||||
|
||||
//Berechnung der Heuristik über die Luftdistanz des nächsten Knoten zum Zielknoten
|
||||
airDist = Math.sqrt(Math.pow((i.getCords()[0] - n2.getCords()[0]), 2)
|
||||
+ Math.pow((i.getCords()[1] - n2.getCords()[1]), 2)) / 100;
|
||||
|
||||
// Berechne Distanz zu nächstem Knoten
|
||||
EdgeWeightMarking marking = (EdgeWeightMarking) j.getMarking();
|
||||
dist = distance.get(nextVertex.getElement()) + marking.getWeight();
|
||||
distToFinish = distance.get(nextVertex.getElement()) + marking.getWeight() + airDist;
|
||||
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;
|
||||
}
|
||||
|
||||
// Vorgänger aktualisieren
|
||||
predecessors.put(i, nextVertex.getElement());
|
||||
|
||||
// Aktualisiere Distanz von Start zu nächstem Knoten
|
||||
distance.put(i, dist);
|
||||
|
||||
// Logging
|
||||
textDescription = "Add " + i.getName() + " with " + distToFinish + " weight to queue.";
|
||||
System.out.println(textDescription);
|
||||
if (i.getScreenVertex().getColor() != Color.RED) {
|
||||
i.getScreenVertex().setColor(Color.YELLOW);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
// Nehme nächsten Knoten in die Queue auf
|
||||
queue.add(new WrapperElement<>(i, distToFinish));
|
||||
}
|
||||
}
|
||||
|
||||
//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,32 +0,0 @@
|
||||
package graph;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class Display {
|
||||
|
||||
public static void main(String[] args) {
|
||||
DirectedGraph<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
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)));
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
System.out.println(myGraph.toString());
|
||||
|
||||
MarkedVertex<VertexMarking> start = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size()));
|
||||
MarkedVertex<VertexMarking> end = myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size()));
|
||||
System.out.println(start.getName() + " to " + end.getName());
|
||||
|
||||
System.out.println(myGraph.getShortestPathDijkstra(start, end));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,108 @@
|
||||
package graph;
|
||||
|
||||
/**
|
||||
* Abstract class representing an edge in a graph.
|
||||
*/
|
||||
public abstract class Edge {
|
||||
|
||||
// ATTRIBUTE
|
||||
// ATTRIBUTES
|
||||
|
||||
/** The name of the edge. */
|
||||
private String name;
|
||||
|
||||
/** The source vertex of the edge. */
|
||||
private Vertex source;
|
||||
|
||||
/** The destination vertex of the edge. */
|
||||
private Vertex destination;
|
||||
|
||||
// CONSTRUCTORS
|
||||
|
||||
// KONSTRUKTOREN
|
||||
|
||||
/**
|
||||
* Default constructor initializes the edge with empty name and null source and destination vertices.
|
||||
*/
|
||||
public Edge() {
|
||||
this.name = "";
|
||||
this.source = null;
|
||||
this.destination = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor initializes the edge with a specified name, source, and destination vertices.
|
||||
*
|
||||
* @param s The name of the edge.
|
||||
* @param n1 The source vertex of the edge.
|
||||
* @param n2 The destination vertex of the edge.
|
||||
*/
|
||||
public Edge(String s, Vertex n1, Vertex n2) {
|
||||
this.name = s;
|
||||
this.source = n1;
|
||||
this.destination = n2;
|
||||
}
|
||||
|
||||
// GETTERS
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Retrieves the name of the edge.
|
||||
*
|
||||
* @return The name of the edge.
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the source vertex of the edge.
|
||||
*
|
||||
* @return The source vertex of the edge.
|
||||
*/
|
||||
public Vertex getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the destination vertex of the edge.
|
||||
*
|
||||
* @return The destination vertex of the edge.
|
||||
*/
|
||||
public Vertex getDestination() {
|
||||
return this.destination;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abstract method to retrieve the screen representation of the edge for visualization.
|
||||
*
|
||||
* @return The visualizationElements.Edge representing the screen edge.
|
||||
*/
|
||||
public abstract visualizationElements.Edge getScreenEdge();
|
||||
|
||||
// SETTERS
|
||||
|
||||
// SET-ER
|
||||
|
||||
/**
|
||||
* Sets the name of the edge.
|
||||
*
|
||||
* @param s The name to set for the edge.
|
||||
*/
|
||||
public void setName(String s) {
|
||||
this.name = s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the source vertex of the edge.
|
||||
*
|
||||
* @param n The source vertex to set for the edge.
|
||||
*/
|
||||
public void setSource(Vertex n) {
|
||||
this.source = n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the destination vertex of the edge.
|
||||
*
|
||||
* @param n The destination vertex to set for the edge.
|
||||
*/
|
||||
public void setDestination(Vertex n) {
|
||||
this.destination = n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
package graph;
|
||||
|
||||
public abstract class EdgeMarking extends Marking{
|
||||
/**
|
||||
* Abstract class representing an edge marking.
|
||||
* Extends the Marking class.
|
||||
*/
|
||||
public abstract class EdgeMarking extends Marking {
|
||||
}
|
||||
|
||||
39
graph/EdgeWeightMarking.java
Normal file
39
graph/EdgeWeightMarking.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package graph;
|
||||
|
||||
/**
|
||||
* Class representing a specific type of edge marking: edge weight.
|
||||
* Inherits from EdgeMarking.
|
||||
*/
|
||||
public class EdgeWeightMarking extends EdgeMarking {
|
||||
|
||||
/** The weight value associated with this edge marking. */
|
||||
private int weight;
|
||||
|
||||
/**
|
||||
* Constructor to initialize the EdgeWeightMarking with a specified weight.
|
||||
*
|
||||
* @param weight The weight value to set.
|
||||
*/
|
||||
public EdgeWeightMarking(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the weight value of this edge marking.
|
||||
*
|
||||
* @param weight The weight value to set.
|
||||
*/
|
||||
public void setWeight(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the weight value of this edge marking.
|
||||
*
|
||||
* @return The weight value of this edge marking.
|
||||
*/
|
||||
public int getWeight() {
|
||||
return this.weight;
|
||||
}
|
||||
}
|
||||
|
||||
271
graph/ExampleGraphs.java
Normal file
271
graph/ExampleGraphs.java
Normal file
@@ -0,0 +1,271 @@
|
||||
package graph;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Class containing example graphs for demonstration purposes.
|
||||
*/
|
||||
public class ExampleGraphs {
|
||||
|
||||
/**
|
||||
* Creates an example graph suitable for demonstrating Dijkstra's and A* algorithms.
|
||||
* This graph contains multiple nodes connected by weighted edges, allowing efficient
|
||||
* calculation of shortest paths from a start node to an end node.
|
||||
*
|
||||
* @return Directed graph instance for example 1.
|
||||
*/
|
||||
public DirectedGraph<VertexMarking, EdgeMarking> example1() {
|
||||
|
||||
/**
|
||||
* Beispiel 1 zeigt ein Gitter aus Knoten und Kanten, bei dem jeder Knoten mit
|
||||
/*
|
||||
* Erstellt einen Beispielgraphen, der sich ideal für die Demonstration der Funktionsweise
|
||||
* des Dijkstra- und A*-Algorithmus eignet. Der Graph enthält eine Vielzahl von Knoten, die durch
|
||||
* gewichtete Kanten verbunden sind. Dies ermöglicht es, den kürzesten Weg von einem Startknoten zu einem
|
||||
* Zielknoten effizient zu berechnen und die Pfadfindung der beiden Algorithmen zu veranschaulichen.
|
||||
*
|
||||
*/
|
||||
|
||||
DirectedGraph<VertexMarking, EdgeMarking> example1 = new DirectedGraph<>();
|
||||
|
||||
// Erstellung der Knoten mit Koordinaten
|
||||
MarkedVertex<VertexMarking> A = new MarkedVertex<>(50, 250, "Start", null, null);
|
||||
MarkedVertex<VertexMarking> B = new MarkedVertex<>(150, 150, "B", null, null);
|
||||
MarkedVertex<VertexMarking> C = new MarkedVertex<>(150, 350, "C", null, null);
|
||||
MarkedVertex<VertexMarking> D = new MarkedVertex<>(250, 100, "D", null, null);
|
||||
MarkedVertex<VertexMarking> E = new MarkedVertex<>(250, 250, "E", null, null);
|
||||
MarkedVertex<VertexMarking> F = new MarkedVertex<>(350, 200, "F", null, null);
|
||||
MarkedVertex<VertexMarking> G = new MarkedVertex<>(450, 300, "G", null, null);
|
||||
MarkedVertex<VertexMarking> H = new MarkedVertex<>(450, 100, "Ende", null, null);
|
||||
|
||||
|
||||
// Hinzufügen der Knoten zum Graphen
|
||||
example1.addVertex(A);
|
||||
example1.addVertex(B);
|
||||
example1.addVertex(C);
|
||||
example1.addVertex(D);
|
||||
example1.addVertex(E);
|
||||
example1.addVertex(F);
|
||||
example1.addVertex(G);
|
||||
example1.addVertex(H);
|
||||
|
||||
// Erstellung der Kanten mit Gewichtungen
|
||||
example1.addEdge(new MarkedEdge<>("AB", A, B, new EdgeWeightMarking(4)));
|
||||
example1.addEdge(new MarkedEdge<>("AC", A, C, new EdgeWeightMarking(2)));
|
||||
example1.addEdge(new MarkedEdge<>("BC", B, C, new EdgeWeightMarking(5)));
|
||||
example1.addEdge(new MarkedEdge<>("BD", B, D, new EdgeWeightMarking(10)));
|
||||
example1.addEdge(new MarkedEdge<>("CD", C, D, new EdgeWeightMarking(3)));
|
||||
example1.addEdge(new MarkedEdge<>("CE", C, E, new EdgeWeightMarking(7)));
|
||||
example1.addEdge(new MarkedEdge<>("DE", D, E, new EdgeWeightMarking(2)));
|
||||
example1.addEdge(new MarkedEdge<>("DF", D, F, new EdgeWeightMarking(2)));
|
||||
example1.addEdge(new MarkedEdge<>("EF", E, F, new EdgeWeightMarking(5)));
|
||||
example1.addEdge(new MarkedEdge<>("EG", E, G, new EdgeWeightMarking(10)));
|
||||
example1.addEdge(new MarkedEdge<>("FG", F, G, new EdgeWeightMarking(3)));
|
||||
example1.addEdge(new MarkedEdge<>("FH", F, H, new EdgeWeightMarking(6)));
|
||||
example1.addEdge(new MarkedEdge<>("GH", G, H, new EdgeWeightMarking(1)));
|
||||
|
||||
return example1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an example grid graph where each node is connected to its horizontal and vertical neighbors.
|
||||
* All edges have the same weight. The start node is in one corner of the grid, and the end node is
|
||||
* in the opposite corner, demonstrating the efficiency of the A* algorithm in structured grid graphs.
|
||||
*
|
||||
* @return Directed graph instance for example 2.
|
||||
*/
|
||||
public DirectedGraph<VertexMarking, EdgeMarking> example2() {
|
||||
|
||||
/*
|
||||
* Beispiel 2 zeigt ein Gitter aus Knoten und Kanten, bei dem jeder Knoten mit
|
||||
* seinen horizontal und vertikal benachbarten Knoten verbunden ist. Alle Kanten
|
||||
* haben die gleiche Gewichtung. Der Startknoten befindet sich in einer Ecke
|
||||
* des Gitters und der Zielknoten in der gegenüberliegenden Ecke. Dadurch wird gezeigt,
|
||||
* wie der A*-Algorithmus durch gezieltere Suche effizienter ist
|
||||
* als der Dijkstra-Algorithmus in einem strukturierten Gittergraphen.
|
||||
*
|
||||
*/
|
||||
|
||||
DirectedGraph<VertexMarking, EdgeMarking> example2 = new DirectedGraph<>();
|
||||
|
||||
int size = 5;
|
||||
MarkedVertex<VertexMarking>[][] vertices = new MarkedVertex[size][size];
|
||||
|
||||
// Knoten erstellen und zum Graph hinzufügen
|
||||
for (int row = 0; row < size; row++) {
|
||||
for (int col = 0; col < size; col++) {
|
||||
String name = String.valueOf((char) ('A' + row * size + col));
|
||||
if (name.equals("A")) {
|
||||
name = "Start";
|
||||
} else if (name.equals("Y")) {
|
||||
name = "Ende";
|
||||
}
|
||||
vertices[row][col] = new MarkedVertex<>(50 + col * 100, 50 + row * 100, name, null, null);
|
||||
example2.addVertex(vertices[row][col]);
|
||||
}
|
||||
}
|
||||
|
||||
// Kanten horizontal und vertikal verbinden
|
||||
for (int row = 0; row < size; row++) {
|
||||
for (int col = 0; col < size; col++) {
|
||||
if (col < size - 1) {
|
||||
addBidirectionalEdge(example2, vertices[row][col], vertices[row][col + 1], new EdgeWeightMarking(1));
|
||||
}
|
||||
if (row < size - 1) {
|
||||
addBidirectionalEdge(example2, vertices[row][col], vertices[row + 1][col], new EdgeWeightMarking(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return example2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an example graph illustrating two paths from a start node to an end node with different characteristics:
|
||||
* one path with few nodes and mostly low-weight edges, and another path with more nodes and higher-weight edges.
|
||||
* The algorithms will alternate exploration between these paths.
|
||||
*
|
||||
* @return Directed graph instance for example 3.
|
||||
*/
|
||||
public DirectedGraph<VertexMarking, EdgeMarking> example3() {
|
||||
|
||||
/*
|
||||
* Beispiel 3 zeigt zwei Wege von einem Startknoten zu einem Zielknoten mit unterschiedlichen Eigenschaften:
|
||||
* Ein Weg (oben) hat wenige Knoten mit Kanten geringer Gewichtung, außer der vorletzten Kante, die hohe Gewichtung hat.
|
||||
* Der andere Weg (unten) hat mehr Knoten mit höherer Gewichtung der Kanten. Die Algorithmen wechseln also mit dem Erkunden
|
||||
* zwischen den beiden Pfaden.
|
||||
*
|
||||
*/
|
||||
|
||||
DirectedGraph<VertexMarking, EdgeMarking> example3 = new DirectedGraph<>();
|
||||
|
||||
MarkedVertex A = new MarkedVertex<>(100, 100, "Start", null, null);
|
||||
MarkedVertex B = new MarkedVertex<>(250, 50, "B", null, null);
|
||||
MarkedVertex C = new MarkedVertex<>(400, 100, "C", null, null);
|
||||
MarkedVertex D = new MarkedVertex<>(550, 50, "D", null, null);
|
||||
MarkedVertex E = new MarkedVertex<>(700, 100, "Ende", null, null);
|
||||
MarkedVertex F = new MarkedVertex<>(250, 200, "F", null, null);
|
||||
MarkedVertex G = new MarkedVertex<>(550, 200, "G", null, null);
|
||||
|
||||
example3.addVertex(A);
|
||||
example3.addVertex(B);
|
||||
example3.addVertex(C);
|
||||
example3.addVertex(D);
|
||||
example3.addVertex(E);
|
||||
example3.addVertex(F);
|
||||
example3.addVertex(G);
|
||||
|
||||
example3.addEdge(new MarkedEdge<>("AB", A, B, new EdgeWeightMarking(1)));
|
||||
example3.addEdge(new MarkedEdge<>("BC", B, C, new EdgeWeightMarking(1)));
|
||||
example3.addEdge(new MarkedEdge<>("CD", C, D, new EdgeWeightMarking(10)));
|
||||
example3.addEdge(new MarkedEdge<>("DE", D, E, new EdgeWeightMarking(1)));
|
||||
|
||||
example3.addEdge(new MarkedEdge<>("AF", A, F, new EdgeWeightMarking(5)));
|
||||
example3.addEdge(new MarkedEdge<>("FG", F, G, new EdgeWeightMarking(5)));
|
||||
example3.addEdge(new MarkedEdge<>("GE", G, E, new EdgeWeightMarking(5)));
|
||||
|
||||
return example3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an example labyrinth graph with four horizontal paths, each consisting of four nodes.
|
||||
* Each path leads to a respective endpoint, demonstrating how algorithms may explore potentially incorrect paths
|
||||
* before finding the correct one, and showing the efficiency of A* in finding the correct path quickly.
|
||||
*
|
||||
* @return Directed graph instance for example 4.
|
||||
*/
|
||||
public DirectedGraph<VertexMarking, EdgeMarking> example4() {
|
||||
|
||||
/*
|
||||
* Beispiel 4 zeigt ein Labyrinth mit vier horizontalen Wegen, die jeweils aus vier Knoten bestehen.
|
||||
* Jeder Weg führt zum Endpunkt E1, E2, E3 bzw. Ende. Ziel ist es zu zeigen, dass die Algorithmen auch
|
||||
* potenziell falsche Wege erkunden können, bevor sie den Endknoten erreichen. Zudem wird gezeigt,
|
||||
* wie A* schnell den richtigen Weg findet, während Djkstra alle Wege durchsucht.
|
||||
*
|
||||
*/
|
||||
|
||||
DirectedGraph<VertexMarking, EdgeMarking> example4 = new DirectedGraph<>();
|
||||
|
||||
// Startpunkt A in der Mitte der Y-Koordinate
|
||||
MarkedVertex A = new MarkedVertex<>(100, 250, "Start", null, null);
|
||||
|
||||
// Erster Weg
|
||||
MarkedVertex B1 = new MarkedVertex<>(200, 100, "B1", null, null);
|
||||
MarkedVertex C1 = new MarkedVertex<>(300, 100, "C1", null, null);
|
||||
MarkedVertex D1 = new MarkedVertex<>(400, 100, "D1", null, null);
|
||||
MarkedVertex E1 = new MarkedVertex<>(500, 100, "E1", null, null); // Endpunkt des ersten Weges
|
||||
|
||||
// Zweiter Weg
|
||||
MarkedVertex B2 = new MarkedVertex<>(200, 200, "B2", null, null);
|
||||
MarkedVertex C2 = new MarkedVertex<>(300, 200, "C2", null, null);
|
||||
MarkedVertex D2 = new MarkedVertex<>(400, 200, "D2", null, null);
|
||||
MarkedVertex E2 = new MarkedVertex<>(500, 200, "E2", null, null); // Endpunkt des zweiten Weges
|
||||
|
||||
// Dritter Weg
|
||||
MarkedVertex B3 = new MarkedVertex<>(200, 300, "B3", null, null);
|
||||
MarkedVertex C3 = new MarkedVertex<>(300, 300, "C3", null, null);
|
||||
MarkedVertex D3 = new MarkedVertex<>(400, 300, "D3", null, null);
|
||||
MarkedVertex E3 = new MarkedVertex<>(500, 300, "E3", null, null); // Endpunkt des dritten Weges
|
||||
|
||||
// Vierter Weg
|
||||
MarkedVertex B4 = new MarkedVertex<>(200, 400, "B4", null, null);
|
||||
MarkedVertex C4 = new MarkedVertex<>(300, 400, "C4", null, null);
|
||||
MarkedVertex D4 = new MarkedVertex<>(400, 400, "D4", null, null);
|
||||
MarkedVertex E4 = new MarkedVertex<>(500, 400, "Ende", null, null); // Endpunkt des vierten Weges
|
||||
|
||||
example4.addVertex(A);
|
||||
example4.addVertex(B1);
|
||||
example4.addVertex(C1);
|
||||
example4.addVertex(D1);
|
||||
example4.addVertex(B2);
|
||||
example4.addVertex(C2);
|
||||
example4.addVertex(D2);
|
||||
example4.addVertex(B3);
|
||||
example4.addVertex(C3);
|
||||
example4.addVertex(D3);
|
||||
example4.addVertex(B4);
|
||||
example4.addVertex(C4);
|
||||
example4.addVertex(D4);
|
||||
example4.addVertex(E1);
|
||||
example4.addVertex(E2);
|
||||
example4.addVertex(E3);
|
||||
example4.addVertex(E4);
|
||||
|
||||
example4.addEdge(new MarkedEdge<>("AB1", A, B1, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("AB2", A, B2, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("AB3", A, B3, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("AB4", A, B4, new EdgeWeightMarking(1)));
|
||||
|
||||
example4.addEdge(new MarkedEdge<>("B1C1", B1, C1, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("B2C2", B2, C2, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("B3C3", B3, C3, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("B4C4", B4, C4, new EdgeWeightMarking(1)));
|
||||
|
||||
example4.addEdge(new MarkedEdge<>("C1D1", C1, D1, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("C2D2", C2, D2, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("C3D3", C3, D3, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("C4D4", C4, D4, new EdgeWeightMarking(1)));
|
||||
|
||||
example4.addEdge(new MarkedEdge<>("D1E1", D1, E1, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("D2E2", D2, E2, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("D3E3", D3, E3, new EdgeWeightMarking(1)));
|
||||
example4.addEdge(new MarkedEdge<>("D4E4", D4, E4, new EdgeWeightMarking(1)));
|
||||
|
||||
return example4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to add a bidirectional edge between two vertices in a graph.
|
||||
*
|
||||
* @param graph The graph instance where the edge should be added.
|
||||
* @param from The starting vertex of the edge.
|
||||
* @param to The ending vertex of the edge.
|
||||
* @param weight The weight marking of the edge.
|
||||
*/
|
||||
private void addBidirectionalEdge(DirectedGraph<VertexMarking, EdgeMarking> graph, MarkedVertex<VertexMarking> from, MarkedVertex<VertexMarking> to, EdgeWeightMarking weight) {
|
||||
MarkedEdge<EdgeMarking> forwardEdge = new MarkedEdge<>("edge" + from.getName() + "_" + to.getName(), from, to, weight);
|
||||
MarkedEdge<EdgeMarking> backwardEdge = new MarkedEdge<>("edge" + to.getName() + "_" + from.getName(), to, from, weight);
|
||||
graph.addEdge(forwardEdge);
|
||||
graph.addEdge(backwardEdge);
|
||||
}
|
||||
}
|
||||
193
graph/Graph.java
193
graph/Graph.java
@@ -3,25 +3,43 @@ package graph;
|
||||
import OurApplication.OurLogElement;
|
||||
import logging.LogElementList;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Abstract class representing a generic graph.
|
||||
* @param <T> Type parameter for vertex markings, extends VertexMarking.
|
||||
* @param <U> Type parameter for edge markings, extends EdgeMarking.
|
||||
*/
|
||||
public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
|
||||
// ATTRIBUTE
|
||||
|
||||
/** The name of the graph. */
|
||||
private String name;
|
||||
|
||||
/** Vector containing all marked vertices in the graph. */
|
||||
private Vector<MarkedVertex<T>> vertexes;
|
||||
|
||||
/** Vector containing all marked edges in the graph. */
|
||||
private Vector<MarkedEdge<U>> edges;
|
||||
|
||||
|
||||
// KONSTRUKTOREN
|
||||
|
||||
/**
|
||||
* Default constructor initializes an empty graph.
|
||||
*/
|
||||
public Graph() {
|
||||
this.edges = new Vector<>();
|
||||
this.vertexes = new Vector<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor that initializes the graph with a given name.
|
||||
* @param s The name of the graph.
|
||||
*/
|
||||
public Graph(String s) {
|
||||
this();
|
||||
this.name = s;
|
||||
@@ -30,35 +48,62 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Returns the name of the graph.
|
||||
* @return The name of the graph.
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all edges in the graph.
|
||||
* @return Vector containing all edges in the graph.
|
||||
*/
|
||||
public Vector<MarkedEdge<U>> getAllEdges() {
|
||||
return this.edges;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all vertices in the graph.
|
||||
* @return Vector containing all vertices in the graph.
|
||||
*/
|
||||
public Vector<MarkedVertex<T>> getAllVertexes() {
|
||||
return this.vertexes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abstract method to get the visualization representation of the graph.
|
||||
* @return Visualization representation of the graph.
|
||||
*/
|
||||
public abstract visualizationElements.Graph getScreenGraph();
|
||||
|
||||
|
||||
/**
|
||||
* Abstract method to get the log list associated with the graph.
|
||||
* @return LogElementList containing log elements associated with the graph.
|
||||
*/
|
||||
public abstract LogElementList<OurLogElement> getLogList();
|
||||
|
||||
|
||||
// SET-ER
|
||||
|
||||
/**
|
||||
* Sets the name of the graph.
|
||||
* @param s The name to set for the graph.
|
||||
*/
|
||||
public void setName(String s) {
|
||||
this.name = s;
|
||||
}
|
||||
|
||||
|
||||
// Ausgabe
|
||||
/**
|
||||
* Returns a string representation of the graph.
|
||||
* @return String representation of the graph.
|
||||
*/
|
||||
public String toString() {
|
||||
String output = "";
|
||||
for (Vertex i: this.vertexes) {
|
||||
@@ -75,13 +120,19 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
|
||||
// HINZUFÜGEN
|
||||
|
||||
// Kante hinzufügen
|
||||
/**
|
||||
* Adds an edge to the graph.
|
||||
* @param e The edge to add.
|
||||
*/
|
||||
public void addEdge(MarkedEdge<U> e) {
|
||||
this.edges.add(e);
|
||||
}
|
||||
|
||||
|
||||
// Knoten hinzufügen
|
||||
/**
|
||||
* Adds a vertex to the graph.
|
||||
* @param n The vertex to add.
|
||||
*/
|
||||
public void addVertex(MarkedVertex<T> n) {
|
||||
this.vertexes.add(n);
|
||||
}
|
||||
@@ -89,13 +140,21 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
|
||||
// LÖSCHEN
|
||||
|
||||
// Kante löschen
|
||||
/**
|
||||
* Removes an edge from the graph.
|
||||
* @param e The edge to remove.
|
||||
*/
|
||||
public void removeEdge(MarkedEdge<U> e) {
|
||||
this.edges.remove(e);
|
||||
}
|
||||
|
||||
|
||||
public void removeEdge(String s) throws NameDoesNotExistException{
|
||||
/**
|
||||
* Removes an edge from the graph based on its name.
|
||||
* @param s The name of the edge to remove.
|
||||
* @throws NameDoesNotExistException If the edge with the specified name does not exist.
|
||||
*/
|
||||
public void removeEdge(String s) throws NameDoesNotExistException {
|
||||
for (MarkedEdge<U> i: this.edges) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
this.removeEdge(i);
|
||||
@@ -106,7 +165,10 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
// Knoten löschen
|
||||
/**
|
||||
* Removes a vertex from the graph.
|
||||
* @param n The vertex to remove.
|
||||
*/
|
||||
public void removeVertex(MarkedVertex<T> n) {
|
||||
for (MarkedEdge<U> i: this.edges) {
|
||||
if (i.getSource() == n || i.getDestination() == n) {
|
||||
@@ -117,7 +179,12 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
public void removeVertex(String s) throws NameDoesNotExistException{
|
||||
/**
|
||||
* Removes a vertex from the graph based on its name.
|
||||
* @param s The name of the vertex to remove.
|
||||
* @throws NameDoesNotExistException If the vertex with the specified name does not exist.
|
||||
*/
|
||||
public void removeVertex(String s) throws NameDoesNotExistException {
|
||||
for (MarkedVertex<T> i: this.vertexes) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
this.removeVertex(i);
|
||||
@@ -130,31 +197,47 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
|
||||
// GRAPH EIGENSCHAFTEN
|
||||
|
||||
// Kantenmenge
|
||||
/**
|
||||
* Returns the number of edges in the graph.
|
||||
* @return The number of edges in the graph.
|
||||
*/
|
||||
public int numberOfEdges() {
|
||||
return this.edges.size();
|
||||
}
|
||||
|
||||
|
||||
// Knotenmenge
|
||||
/**
|
||||
* Returns the number of vertices in the graph.
|
||||
* @return The number of vertices in the graph.
|
||||
*/
|
||||
public int numberOfVertexes() {
|
||||
return this.vertexes.size();
|
||||
}
|
||||
|
||||
|
||||
// Grad des Graphen
|
||||
// https://loeh.app.uni-regensburg.de/teaching/discmath_ws0910/graphentheorie_ueberblick.pdf
|
||||
/**
|
||||
* Computes and returns the degree of the graph.
|
||||
* @return The degree of the graph.
|
||||
*/
|
||||
public int degree() {
|
||||
return 2 * this.edges.size();
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, ob Knoten im Graph
|
||||
/**
|
||||
* Checks if a vertex is present in the graph.
|
||||
* @param n The vertex to check.
|
||||
* @return True if the vertex is present, false otherwise.
|
||||
*/
|
||||
public boolean hasVertex(MarkedVertex<T> n) {
|
||||
return this.vertexes.contains(n);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a vertex with a specific name is present in the graph.
|
||||
* @param s The name of the vertex to check.
|
||||
* @return True if the vertex with the given name is present, false otherwise.
|
||||
*/
|
||||
public boolean hasVertex(String s) {
|
||||
for (MarkedVertex<T> i: this.vertexes) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
@@ -165,12 +248,20 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, ob Kante im Graph
|
||||
/**
|
||||
* Checks if an edge is present in the graph.
|
||||
* @param e The edge to check.
|
||||
* @return True if the edge is present, false otherwise.
|
||||
*/
|
||||
public boolean hasEdge(MarkedEdge<U> e) {
|
||||
return this.edges.contains(e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if an edge with a specific name is present in the graph.
|
||||
* @param s The name of the edge to check.
|
||||
* @return True if the edge with the given name is present, false otherwise.
|
||||
*/
|
||||
public boolean hasEdge(String s) {
|
||||
for (MarkedEdge<U> i: this.edges) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
@@ -183,13 +274,15 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
|
||||
// KNOTEN EIGENSCHAFTEN
|
||||
|
||||
// Prüfung, ob Kante zwischen zwei Knoten
|
||||
// TODO schauen, ob es Aufgabe entspricht
|
||||
/**
|
||||
* Checks if there is an edge between two vertices in the graph.
|
||||
* @param v1 First vertex.
|
||||
* @param v2 Second vertex.
|
||||
* @return True if there is an edge between the vertices, false otherwise.
|
||||
*/
|
||||
public boolean hasEdge(MarkedVertex<T> v1, MarkedVertex<T> v2) {
|
||||
for (MarkedEdge<U> i: this.edges) {
|
||||
if (i.getSource() == v1 && i.getDestination() == v2) {
|
||||
return true;
|
||||
} else if (i.getSource() == v2 && i.getDestination() == v1) {
|
||||
if ((i.getSource() == v1 && i.getDestination() == v2) || (i.getSource() == v2 && i.getDestination() == v1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -197,6 +290,13 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if there is an edge between two vertices identified by their names.
|
||||
* @param s1 Name of the first vertex.
|
||||
* @param s2 Name of the second vertex.
|
||||
* @return True if there is an edge between the vertices, false otherwise.
|
||||
* @throws NameDoesNotExistException If one of the vertex names does not exist in the graph.
|
||||
*/
|
||||
public boolean hasEdge(String s1, String s2) throws NameDoesNotExistException {
|
||||
MarkedVertex<T> n1 = null;
|
||||
MarkedVertex<T> n2 = null;
|
||||
@@ -215,7 +315,12 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, ob zwei Knoten adjazent sind
|
||||
/**
|
||||
* Checks if two vertices are adjacent (connected by an edge) in the graph.
|
||||
* @param n1 First vertex.
|
||||
* @param n2 Second vertex.
|
||||
* @return True if the vertices are adjacent, false otherwise.
|
||||
*/
|
||||
public boolean areAdjacent(MarkedVertex<T> n1, MarkedVertex<T> n2) {
|
||||
for (MarkedEdge<U> i: this.edges) {
|
||||
if ((i.getSource() == n1 && i.getDestination() == n2) || (i.getSource() == n2 && i.getDestination() == n1)) {
|
||||
@@ -226,6 +331,13 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if two vertices identified by their names are adjacent (connected by an edge) in the graph.
|
||||
* @param s1 Name of the first vertex.
|
||||
* @param s2 Name of the second vertex.
|
||||
* @return True if the vertices are adjacent, false otherwise.
|
||||
* @throws NameDoesNotExistException If one of the vertex names does not exist in the graph.
|
||||
*/
|
||||
public boolean areAdjacent(String s1, String s2) throws NameDoesNotExistException {
|
||||
MarkedVertex<T> n1 = null;
|
||||
MarkedVertex<T> n2 = null;
|
||||
@@ -244,7 +356,11 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, ob Knoten eine Schlinge besitzt
|
||||
/**
|
||||
* Checks if a vertex has a loop (an edge connecting it to itself) in the graph.
|
||||
* @param n The vertex to check.
|
||||
* @return True if the vertex has a loop, false otherwise.
|
||||
*/
|
||||
public boolean hasLoop(MarkedVertex<T> n) {
|
||||
for (MarkedEdge<U> i: this.edges) {
|
||||
if (i.getSource() == i.getDestination() && i.getSource() == n) {
|
||||
@@ -255,7 +371,13 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
public boolean hasLoop(String s) throws NameDoesNotExistException{
|
||||
/**
|
||||
* Checks if a vertex identified by its name has a loop (an edge connecting it to itself) in the graph.
|
||||
* @param s The name of the vertex to check.
|
||||
* @return True if the vertex has a loop, false otherwise.
|
||||
* @throws NameDoesNotExistException If the vertex name does not exist in the graph.
|
||||
*/
|
||||
public boolean hasLoop(String s) throws NameDoesNotExistException {
|
||||
for (MarkedVertex<T> i: this.vertexes) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
return hasLoop(i);
|
||||
@@ -265,6 +387,31 @@ public abstract class Graph<T extends VertexMarking, U extends EdgeMarking> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the screen graph colors of all vertices to black.
|
||||
*/
|
||||
public void clearScreenGraphColor() {
|
||||
for (visualizationElements.Vertex screenVertexes : this.getScreenGraph().getVertexes()) {
|
||||
screenVertexes.setColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abstract method to find the shortest path between two vertices using Dijkstra's algorithm.
|
||||
* @param n1 Starting vertex.
|
||||
* @param n2 Destination vertex.
|
||||
* @return Length of the shortest path between the vertices.
|
||||
*/
|
||||
public abstract int getShortestPathDijkstra(MarkedVertex<T> n1, MarkedVertex<T> n2);
|
||||
|
||||
|
||||
/**
|
||||
* Abstract method to find the shortest path between two vertices using A* algorithm.
|
||||
* @param n1 Starting vertex.
|
||||
* @param n2 Destination vertex.
|
||||
* @return Length of the shortest path between the vertices.
|
||||
*/
|
||||
public abstract double getShortestPathAStar(MarkedVertex<T> n1, MarkedVertex<T> n2);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,74 +2,97 @@ package graph;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class MarkedEdge<U extends EdgeMarking> extends Edge{
|
||||
/**
|
||||
* The MarkedEdge class extends the Edge class and includes additional attributes
|
||||
* for marking and visualization on a screen. It supports constructors to initialize
|
||||
* these attributes and provides getter and setter methods for accessing and modifying them.
|
||||
*
|
||||
* @param <U> A type that extends EdgeMarking, used for marking the edge.
|
||||
*/
|
||||
public class MarkedEdge<U extends EdgeMarking> extends Edge {
|
||||
|
||||
// ATTRIBUTE
|
||||
// ATTRIBUTES
|
||||
|
||||
private U marking;
|
||||
// Für Aufgabe 2
|
||||
private int weighting;
|
||||
|
||||
private visualizationElements.Edge screenEdge;
|
||||
|
||||
|
||||
// KONSTRUKTOREN
|
||||
// CONSTRUCTORS
|
||||
|
||||
/**
|
||||
* Default constructor initializes the edge with default values.
|
||||
*/
|
||||
public MarkedEdge() {
|
||||
super();
|
||||
this.screenEdge = new visualizationElements.Edge(null, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor initializes the edge with a name, vertices, and marking.
|
||||
*
|
||||
* @param s The name of the edge.
|
||||
* @param n1 The source vertex of the edge.
|
||||
* @param n2 The destination vertex of the edge.
|
||||
* @param u The marking of the edge.
|
||||
*/
|
||||
public MarkedEdge(String s, Vertex n1, Vertex n2, U u) {
|
||||
super(s, n1, n2);
|
||||
this.marking = u;
|
||||
this.screenEdge = new visualizationElements.Edge(n1.getScreenVertex(), n2.getScreenVertex(), u.toString());
|
||||
EdgeWeightMarking m = (EdgeWeightMarking) this.marking;
|
||||
this.screenEdge = new visualizationElements.Edge(
|
||||
n1.getScreenVertex(),
|
||||
n2.getScreenVertex(),
|
||||
Integer.toString(m.getWeight()),
|
||||
Color.BLACK);
|
||||
}
|
||||
|
||||
|
||||
// TODO ACHTUNG DEBUG!!!!
|
||||
public MarkedEdge(String s, Vertex n1, Vertex n2, U u, int w) {
|
||||
super(s, n1, n2);
|
||||
this.marking = u;
|
||||
this.weighting = w;
|
||||
this.screenEdge = new visualizationElements.Edge(n1.getScreenVertex(), n2.getScreenVertex(), "u.toString()", Color.BLACK);
|
||||
}
|
||||
|
||||
|
||||
// GET-ER
|
||||
// GETTERS
|
||||
|
||||
/**
|
||||
* Gets the marking of the edge.
|
||||
*
|
||||
* @return The marking of the edge.
|
||||
*/
|
||||
public U getMarking() {
|
||||
return this.marking;
|
||||
}
|
||||
|
||||
|
||||
// Für Aufgabe 2
|
||||
public int getWeighting() {
|
||||
return this.weighting;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the screen edge used for visualization.
|
||||
*
|
||||
* @return The screen edge.
|
||||
*/
|
||||
public visualizationElements.Edge getScreenEdge() {
|
||||
return this.screenEdge;
|
||||
}
|
||||
|
||||
|
||||
// SET-ER
|
||||
// SETTERS
|
||||
|
||||
/**
|
||||
* Sets the marking of the edge.
|
||||
*
|
||||
* @param u The new marking of the edge.
|
||||
*/
|
||||
public void setMarking(U u) {
|
||||
this.marking = u;
|
||||
EdgeWeightMarking m = (EdgeWeightMarking) this.marking;
|
||||
this.screenEdge.setMarking(Integer.toString(m.getWeight()));
|
||||
}
|
||||
|
||||
|
||||
// Für Aufgabe 2
|
||||
public void setWeighting(int w) {
|
||||
this.weighting = w;
|
||||
}
|
||||
// OUTPUT
|
||||
|
||||
|
||||
// Ausgabe
|
||||
/**
|
||||
* Returns a string representation of the MarkedEdge.
|
||||
*
|
||||
* @return A string representing the MarkedEdge.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkedEdge " + this.getName() + " from " + this.getSource().getName() + " to " + this.getDestination().getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,20 +2,29 @@ package graph;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class MarkedVertex<T extends VertexMarking> extends Vertex{
|
||||
/**
|
||||
* The MarkedVertex class extends the Vertex class and includes additional attributes
|
||||
* for marking, coordinates, and visualization on a screen. It supports various
|
||||
* constructors to initialize these attributes and provides getter and setter methods
|
||||
* for accessing and modifying them.
|
||||
*
|
||||
* @param <T> A type that extends VertexMarking, used for marking the vertex.
|
||||
*/
|
||||
public class MarkedVertex<T extends VertexMarking> extends Vertex {
|
||||
|
||||
// ATTRIBUTE
|
||||
|
||||
private T marking;
|
||||
|
||||
private int xCord;
|
||||
private int yCord;
|
||||
|
||||
private visualizationElements.Vertex screenVertex;
|
||||
|
||||
|
||||
// KONSTRUKTOREN
|
||||
// CONSTRUCTORS
|
||||
|
||||
/**
|
||||
* Default constructor initializes the vertex with default values.
|
||||
*/
|
||||
public MarkedVertex() {
|
||||
super();
|
||||
this.screenVertex = new visualizationElements.Vertex(0, 0);
|
||||
@@ -24,49 +33,88 @@ public class MarkedVertex<T extends VertexMarking> extends Vertex{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor initializes the vertex with a name and marking.
|
||||
*
|
||||
* @param s The name of the vertex.
|
||||
* @param t The marking of the vertex.
|
||||
*/
|
||||
public MarkedVertex(String s, T t) {
|
||||
super(s);
|
||||
this.marking = t;
|
||||
this.screenVertex = new visualizationElements.Vertex(0, 0, t.toString());
|
||||
this.screenVertex = new visualizationElements.Vertex(0, 0);
|
||||
this.xCord = 0;
|
||||
this.yCord = 0;
|
||||
}
|
||||
|
||||
|
||||
// TODO ACHTUNG DEBUG!!!!
|
||||
public MarkedVertex(int xCord, int yCord, String s, T t, Color color) {
|
||||
super(s);
|
||||
/**
|
||||
* Constructor initializes the vertex with coordinates, name, marking, and color.
|
||||
*
|
||||
* @param xCord The x-coordinate of the vertex.
|
||||
* @param yCord The y-coordinate of the vertex.
|
||||
* @param name The name of the vertex.
|
||||
* @param t The marking of the vertex.
|
||||
* @param color The color of the vertex for visualization purposes.
|
||||
*/
|
||||
public MarkedVertex(int xCord, int yCord, String name, T t, Color color) {
|
||||
super(name);
|
||||
this.marking = t;
|
||||
this.screenVertex = new visualizationElements.Vertex(xCord, yCord, "t.toString()", color);
|
||||
this.screenVertex = new visualizationElements.Vertex(xCord, yCord, name, color);
|
||||
this.xCord = xCord;
|
||||
this.yCord = yCord;
|
||||
}
|
||||
|
||||
|
||||
// GET-ER
|
||||
// GETTERS
|
||||
|
||||
/**
|
||||
* Gets the marking of the vertex.
|
||||
*
|
||||
* @return The marking of the vertex.
|
||||
*/
|
||||
public T getMarking() {
|
||||
return this.marking;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the screen vertex used for visualization.
|
||||
*
|
||||
* @return The screen vertex.
|
||||
*/
|
||||
public visualizationElements.Vertex getScreenVertex() {
|
||||
return this.screenVertex;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the coordinates of the vertex.
|
||||
*
|
||||
* @return An array containing the x and y coordinates of the vertex.
|
||||
*/
|
||||
public int[] getCords() {
|
||||
return new int[]{this.xCord, this.yCord};
|
||||
}
|
||||
|
||||
|
||||
// SET-ER
|
||||
// SETTERS
|
||||
|
||||
/**
|
||||
* Sets the marking of the vertex.
|
||||
*
|
||||
* @param t The new marking of the vertex.
|
||||
*/
|
||||
public void setMarking(T t) {
|
||||
this.marking = t;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the coordinates of the vertex and updates the screen vertex's position.
|
||||
*
|
||||
* @param cords An array containing the new x and y coordinates of the vertex.
|
||||
*/
|
||||
public void setCords(int[] cords) {
|
||||
this.xCord = cords[0];
|
||||
this.yCord = cords[1];
|
||||
@@ -75,7 +123,14 @@ public class MarkedVertex<T extends VertexMarking> extends Vertex{
|
||||
}
|
||||
|
||||
|
||||
// Ausgabe
|
||||
// OUTPUT
|
||||
|
||||
/**
|
||||
* Returns a string representation of the MarkedVertex.
|
||||
*
|
||||
* @return A string representing the MarkedVertex.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkedVertex " + this.getName();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
package graph;
|
||||
|
||||
/**
|
||||
* Abstract class representing a marking for vertices or edges in a graph.
|
||||
* This class serves as a base class for specific types of markings.
|
||||
*/
|
||||
public abstract class Marking {
|
||||
// No additional attributes or methods are defined in this abstract class.
|
||||
// Specific types of markings (VertexMarking, EdgeMarking) should extend this class.
|
||||
}
|
||||
|
||||
@@ -1,67 +1,135 @@
|
||||
package graph;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
// Exception, das User nach einem ungültigen Knoten sucht
|
||||
/**
|
||||
* Exception thrown when a user attempts to access a non-existent vertex by name.
|
||||
*/
|
||||
public class NameDoesNotExistException extends Exception {
|
||||
|
||||
/**
|
||||
* Constructs a new NameDoesNotExistException with no detail message.
|
||||
*/
|
||||
public NameDoesNotExistException() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new NameDoesNotExistException with the specified detail message.
|
||||
*
|
||||
* @param message The detail message.
|
||||
*/
|
||||
public NameDoesNotExistException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new NameDoesNotExistException with the specified detail message and cause.
|
||||
*
|
||||
* @param message The detail message.
|
||||
* @param cause The cause of the exception.
|
||||
*/
|
||||
public NameDoesNotExistException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new NameDoesNotExistException with the specified cause and a detail message
|
||||
* that includes the cause's description.
|
||||
*
|
||||
* @param cause The cause of the exception.
|
||||
*/
|
||||
public NameDoesNotExistException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Element in der PriorityQueue
|
||||
|
||||
/**
|
||||
* Represents an element stored in a priority queue for graph algorithms.
|
||||
*
|
||||
* @param <T> The type of vertex marking associated with the element.
|
||||
*/
|
||||
class WrapperElement<T extends VertexMarking> {
|
||||
|
||||
// ATTRIBUTE
|
||||
|
||||
private MarkedVertex<T> n1;
|
||||
private int prio;
|
||||
private MarkedVertex<T> element;
|
||||
private double priority;
|
||||
|
||||
|
||||
// KONSTRUKTOR
|
||||
|
||||
public WrapperElement(MarkedVertex<T> n1, int prio) {
|
||||
this.n1 = n1;
|
||||
this.prio = prio;
|
||||
/**
|
||||
* Constructs a WrapperElement with the specified marked vertex and priority.
|
||||
*
|
||||
* @param element The marked vertex to wrap.
|
||||
* @param priority The priority associated with the element.
|
||||
*/
|
||||
public WrapperElement(MarkedVertex<T> element, double priority) {
|
||||
this.element = element;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Retrieves the marked vertex stored in this wrapper element.
|
||||
*
|
||||
* @return The marked vertex.
|
||||
*/
|
||||
public MarkedVertex<T> getElement() {
|
||||
return this.n1;
|
||||
return this.element;
|
||||
}
|
||||
|
||||
|
||||
public int getPrio() {
|
||||
return this.prio;
|
||||
/**
|
||||
* Retrieves the priority associated with this wrapper element.
|
||||
*
|
||||
* @return The priority.
|
||||
*/
|
||||
public double getPriority() {
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
|
||||
// Ausgabe
|
||||
|
||||
/**
|
||||
* Returns a string representation of this WrapperElement.
|
||||
*
|
||||
* @return A string representation containing the element and its priority.
|
||||
*/
|
||||
public String toString() {
|
||||
return "Wrapper with " + this.n1 + " with prio " + this.prio;
|
||||
return "WrapperElement{" +
|
||||
"element=" + element +
|
||||
", priority=" + priority +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 2 Elemente in der PriorityQueue Vergleichen
|
||||
|
||||
/**
|
||||
* Comparator for comparing WrapperElement objects based on their priority.
|
||||
*
|
||||
* @param <T> The type of vertex marking associated with the WrapperElement.
|
||||
*/
|
||||
class WrapperComparator<T extends VertexMarking> implements Comparator<WrapperElement<T>> {
|
||||
|
||||
/**
|
||||
* Compares two WrapperElement objects based on their priorities.
|
||||
*
|
||||
* @param element1 The first WrapperElement to compare.
|
||||
* @param element2 The second WrapperElement to compare.
|
||||
* @return A negative integer, zero, or a positive integer as the first element's
|
||||
* priority is less than, equal to, or greater than the second element's priority.
|
||||
*/
|
||||
public int compare(WrapperElement<T> element1, WrapperElement<T> element2) {
|
||||
return Integer.compare(element1.getPrio(), element2.getPrio());
|
||||
return Double.compare(element1.getPriority(), element2.getPriority());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,19 @@ import visualizationElements.Edge;
|
||||
import visualizationElements.EdgeStyle;
|
||||
import visualizationElements.Vertex;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Represents an undirected graph with vertices marked by T and edges marked by U.
|
||||
* Inherits from the Graph class and provides additional functionality specific to undirected graphs.
|
||||
*
|
||||
* @param <T> Type of marking for vertices in the graph.
|
||||
* @param <U> Type of marking for edges in the graph.
|
||||
*/
|
||||
public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> extends Graph<T, U> {
|
||||
|
||||
// ATTRIBUTE
|
||||
@@ -19,6 +29,9 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
|
||||
// KONSTRUKTOREN
|
||||
|
||||
/**
|
||||
* Constructs an empty undirected graph with default properties.
|
||||
*/
|
||||
public UndirectedGraph() {
|
||||
super();
|
||||
this.screenGraph = new visualizationElements.Graph(new Vector<Vertex>(), new Vector<Edge>(), false, EdgeStyle.Direct);
|
||||
@@ -26,6 +39,11 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an undirected graph with a specified name.
|
||||
*
|
||||
* @param s The name of the graph.
|
||||
*/
|
||||
public UndirectedGraph(String s) {
|
||||
super(s);
|
||||
this.screenGraph = new visualizationElements.Graph(new Vector<Vertex>(), new Vector<Edge>(), false, EdgeStyle.Direct);
|
||||
@@ -35,26 +53,67 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Retrieves the visualization graph associated with this undirected graph.
|
||||
*
|
||||
* @return The visualization graph.
|
||||
*/
|
||||
public visualizationElements.Graph getScreenGraph() {
|
||||
return this.screenGraph;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the log list containing logging elements related to operations on this graph.
|
||||
*
|
||||
* @return The log element list.
|
||||
*/
|
||||
public LogElementList<OurLogElement> getLogList() {
|
||||
return this.logList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and retrieves a deep copy of the visualization graph associated with this undirected graph.
|
||||
*
|
||||
* @return A deep copy of the visualization graph.
|
||||
*/
|
||||
public visualizationElements.Graph getScreenGraphCopy() {
|
||||
visualizationElements.Graph graphCopy = new visualizationElements.Graph(new Vector<Vertex>(), new Vector<Edge>(), false, EdgeStyle.Direct);
|
||||
Vector<visualizationElements.Vertex> copiedVertexes = new Vector<>();
|
||||
Vector<visualizationElements.Edge> copiedEdges = new Vector<>();
|
||||
for (visualizationElements.Vertex vertexCopy : this.screenGraph.getVertexes()) {
|
||||
visualizationElements.Vertex newCopiedVertex = new visualizationElements.Vertex(vertexCopy.getXpos(), vertexCopy.getYpos(), vertexCopy.getMarking(), vertexCopy.getColor());
|
||||
copiedVertexes.add(newCopiedVertex);
|
||||
graphCopy.setVertexes(copiedVertexes);
|
||||
}
|
||||
for (visualizationElements.Edge edgeCopy : this.screenGraph.getEdges()) {
|
||||
visualizationElements.Edge newCopiedEdge = new visualizationElements.Edge(edgeCopy.getSource(), edgeCopy.getDestination(), edgeCopy.getMarking(), edgeCopy.getColor());
|
||||
copiedEdges.add(newCopiedEdge);
|
||||
graphCopy.setEdges(copiedEdges);
|
||||
}
|
||||
return graphCopy;
|
||||
}
|
||||
|
||||
|
||||
// HINZUFÜGEN
|
||||
|
||||
// Kante hinzufügen
|
||||
/**
|
||||
* Adds an edge to the undirected graph and updates the associated visualization graph.
|
||||
*
|
||||
* @param e The edge to be added.
|
||||
*/
|
||||
public void addEdge(MarkedEdge<U> e) {
|
||||
super.addEdge(e);
|
||||
this.screenGraph.getEdges().add(e.getScreenEdge());
|
||||
}
|
||||
|
||||
|
||||
// Knoten hinzufügen
|
||||
/**
|
||||
* Adds a vertex to the undirected graph and updates the associated visualization graph.
|
||||
*
|
||||
* @param n The vertex to be added.
|
||||
*/
|
||||
public void addVertex(MarkedVertex<T> n) {
|
||||
super.addVertex(n);
|
||||
this.screenGraph.getVertexes().add(n.getScreenVertex());
|
||||
@@ -63,14 +122,22 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
|
||||
// LÖSCHEN
|
||||
|
||||
// Kante löschen
|
||||
/**
|
||||
* Removes an edge from the undirected graph and updates the associated visualization graph.
|
||||
*
|
||||
* @param e The edge to be removed.
|
||||
*/
|
||||
public void removeEdge(MarkedEdge<U> e) {
|
||||
super.removeEdge(e);
|
||||
this.screenGraph.getEdges().remove(e.getScreenEdge());
|
||||
}
|
||||
|
||||
|
||||
// Knoten löschen
|
||||
/**
|
||||
* Removes a vertex from the undirected graph and updates the associated visualization graph.
|
||||
*
|
||||
* @param n The vertex to be removed.
|
||||
*/
|
||||
public void removeVertex(MarkedVertex<T> n) {
|
||||
super.removeVertex(n);
|
||||
this.screenGraph.getVertexes().remove(n.getScreenVertex());
|
||||
@@ -79,7 +146,13 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
|
||||
// KNOTEN EIGENSCHAFTEN
|
||||
|
||||
// Prüfung des Grades eines Knotens
|
||||
/**
|
||||
* Returns the degree of a specified vertex in the undirected graph.
|
||||
* The degree of a vertex is the number of edges incident to it.
|
||||
*
|
||||
* @param n The vertex for which to determine the degree.
|
||||
* @return The degree of the vertex.
|
||||
*/
|
||||
public int degree(MarkedVertex<T> n) {
|
||||
int degree = 0;
|
||||
for (MarkedEdge<U> i: this.getAllEdges()) {
|
||||
@@ -94,7 +167,14 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
}
|
||||
|
||||
|
||||
public int degree(String s) throws NameDoesNotExistException{
|
||||
/**
|
||||
* Returns the degree of a specified vertex by its name in the undirected graph.
|
||||
*
|
||||
* @param s The name of the vertex for which to determine the degree.
|
||||
* @return The degree of the vertex.
|
||||
* @throws NameDoesNotExistException If the vertex with the specified name does not exist in the graph.
|
||||
*/
|
||||
public int degree(String s) throws NameDoesNotExistException {
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
if (Objects.equals(i.getName(), s)) {
|
||||
return degree(i);
|
||||
@@ -104,7 +184,12 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
}
|
||||
|
||||
|
||||
// Prüfung, welche Knoten Nachbarn sind
|
||||
/**
|
||||
* Returns a vector containing all neighbors (adjacent vertices) of a specified vertex in the undirected graph.
|
||||
*
|
||||
* @param n The vertex for which to retrieve neighbors.
|
||||
* @return A vector of neighboring vertices.
|
||||
*/
|
||||
public Vector<MarkedVertex<T>> getNeighbours(MarkedVertex<T> n) {
|
||||
Vector<MarkedVertex<T>> neighbours = new Vector<>();
|
||||
for (MarkedEdge<U> i: this.getAllEdges()) {
|
||||
@@ -118,8 +203,288 @@ public class UndirectedGraph<T extends VertexMarking, U extends EdgeMarking> ext
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Computes the shortest path between two vertices using Dijkstra's algorithm in the undirected graph.
|
||||
*
|
||||
* @param n1 The starting vertex of the shortest path.
|
||||
* @param n2 The ending vertex of the shortest path.
|
||||
* @return The length of the shortest path between n1 and n2.
|
||||
*/
|
||||
public int getShortestPathDijkstra(MarkedVertex<T> n1, MarkedVertex<T> n2) {
|
||||
return 1;
|
||||
|
||||
// Erstellt Hashmap um Distanz von Startnoten zu jedem Knoten auf dem Graph zu tracken
|
||||
// Erstellt Hashmap um zu tracken welche Knoten schon besucht wurden
|
||||
// Erstelle Hashmap um Vorgängerknoten zu tracken
|
||||
// Initialisierung aller Distanzen auf UNENDLICH (= -1)
|
||||
// Initialisierung, dass kein Knoten besucht wurde
|
||||
// Initialisierung aller Vorgänger auf null
|
||||
HashMap<MarkedVertex<T>, Integer> distance = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, Boolean> visited = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, MarkedVertex<T>> predecessors = new HashMap<>();
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
distance.put(i, -1);
|
||||
visited.put(i, false);
|
||||
predecessors.put(i, null);
|
||||
}
|
||||
|
||||
// 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);
|
||||
queue.add(new WrapperElement<>(n1, 0));
|
||||
|
||||
// Variable, die Distanz zwischen aktuellem Knoten und Nachfolger speichert
|
||||
int dist = 0;
|
||||
// Zähler für LogList
|
||||
int step = 0;
|
||||
// String für den Description Inhalt
|
||||
String textDescription;
|
||||
|
||||
// Färben der Start und Ziel Knoten für Visualisierung + hinzufügen zur LogList
|
||||
n1.getScreenVertex().setColor(Color.RED);
|
||||
n2.getScreenVertex().setColor(Color.RED);
|
||||
textDescription = "Startknoten: " + n1.getScreenVertex().getMarking()
|
||||
+ ", Endknoten: " + n2.getScreenVertex().getMarking();
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
// Den nächsten Knoten, der am wenigsten kostet, besuchen
|
||||
WrapperElement<T> nextVertex = queue.poll();
|
||||
|
||||
// Falls Knoten schon besucht
|
||||
if(!visited.get(nextVertex.getElement())){
|
||||
// Knoten als besucht makieren
|
||||
visited.put(nextVertex.getElement(), true);
|
||||
textDescription = "Visit " + nextVertex.getElement().getName();
|
||||
// Logging
|
||||
System.out.println(textDescription);
|
||||
if (nextVertex.getElement().getScreenVertex().getColor() != Color.RED) {
|
||||
nextVertex.getElement().getScreenVertex().setColor(Color.BLUE);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}
|
||||
|
||||
|
||||
// Wenn Weg gefunden, brich ab
|
||||
if (nextVertex.getElement() == n2) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
return distance.get(n2);
|
||||
}
|
||||
|
||||
|
||||
// Gehe von diesem Knoten aus alle erreichbaren Knoten durch
|
||||
for (MarkedVertex<T> i: this.getNeighbours(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
|
||||
EdgeWeightMarking marking = (EdgeWeightMarking) j.getMarking();
|
||||
dist = distance.get(nextVertex.getElement()) + marking.getWeight();
|
||||
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;
|
||||
}
|
||||
|
||||
// Vorgänger aktualisieren
|
||||
predecessors.put(i, nextVertex.getElement());
|
||||
|
||||
// Aktualisiere Distanz von Start zu nächstem Knoten
|
||||
distance.put(i, dist);
|
||||
|
||||
// Logging
|
||||
textDescription = "Add " + i.getName() + " with " + dist + " weight to queue.";
|
||||
System.out.println(textDescription);
|
||||
if (i.getScreenVertex().getColor() != Color.RED) {
|
||||
i.getScreenVertex().setColor(Color.YELLOW);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
// Nehme nächsten Knoten in die Queue auf
|
||||
queue.add(new WrapperElement<>(i, dist));
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Computes the shortest path between two vertices using A* algorithm in the undirected graph.
|
||||
*
|
||||
* @param n1 The starting vertex of the shortest path.
|
||||
* @param n2 The ending vertex of the shortest path.
|
||||
* @return The length of the shortest path between n1 and n2.
|
||||
*/
|
||||
public double getShortestPathAStar(MarkedVertex<T> n1, MarkedVertex<T> n2) {
|
||||
|
||||
// Erstellt Hashmap um Distanz von Startnoten zu jedem Knoten auf dem Graph zu tracken
|
||||
// Erstellt Hashmap um zu tracken welche Knoten schon besucht wurden
|
||||
// Erstelle Hashmap um Vorgängerknoten zu tracken
|
||||
// Initialisierung aller Distanzen auf UNENDLICH (= -1)
|
||||
// Initialisierung, dass kein Knoten besucht wurde
|
||||
// Initialisierung aller Vorgänger auf null
|
||||
HashMap<MarkedVertex<T>, Double> distance = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, Boolean> visited = new HashMap<>();
|
||||
HashMap<MarkedVertex<T>, MarkedVertex<T>> predecessors = new HashMap<>();
|
||||
for (MarkedVertex<T> i: this.getAllVertexes()) {
|
||||
distance.put(i, -1.0);
|
||||
visited.put(i, false);
|
||||
predecessors.put(i, null);
|
||||
}
|
||||
|
||||
// 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.0);
|
||||
queue.add(new WrapperElement<>(n1, 0));
|
||||
|
||||
// Variable, die Distanz zwischen aktuellem Knoten und Nachfolger speichert
|
||||
double dist = 0;
|
||||
// Variable, die Distanz zwischen dem potenziell nächsten Knoten und dem Zielknoten speichert
|
||||
double airDist = 0;
|
||||
// Variable, die Distanz zwischen dem aktuellen Knoten bis zum Endknoten speichert
|
||||
double distToFinish = 0;
|
||||
// Zähler für LogList
|
||||
int step = 0;
|
||||
// String für den Description Inhalt
|
||||
String textDescription;
|
||||
|
||||
// Färben der Start und Ziel Knoten für Visualisierung + hinzufügen zur LogList
|
||||
n1.getScreenVertex().setColor(Color.RED);
|
||||
n2.getScreenVertex().setColor(Color.RED);
|
||||
textDescription = "Startknoten: " + n1.getScreenVertex().getMarking()
|
||||
+ ", Endknoten: " + n2.getScreenVertex().getMarking();
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
// Den nächsten Knoten, der am wenigsten kostet, besuchen
|
||||
WrapperElement<T> nextVertex = queue.poll();
|
||||
|
||||
// Falls Knoten schon besucht
|
||||
if(!visited.get(nextVertex.getElement())){
|
||||
// Knoten als besucht makieren
|
||||
visited.put(nextVertex.getElement(), true);
|
||||
textDescription = "Visit " + nextVertex.getElement().getName();
|
||||
// Logging
|
||||
System.out.println(textDescription);
|
||||
if (nextVertex.getElement().getScreenVertex().getColor() != Color.RED) {
|
||||
nextVertex.getElement().getScreenVertex().setColor(Color.BLUE);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
}
|
||||
|
||||
// Wenn Weg gefunden, brich ab
|
||||
if (nextVertex.getElement() == n2) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//zurücksetzten der Färbungen
|
||||
this.clearScreenGraphColor();
|
||||
return distance.get(n2);
|
||||
}
|
||||
|
||||
|
||||
// Gehe von diesem Knoten aus alle erreichbaren Knoten durch
|
||||
for (MarkedVertex<T> i: this.getNeighbours(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) {
|
||||
|
||||
//Berechnung der Heuristik über die Luftdistanz des nächsten Knoten zum Zielknoten
|
||||
airDist = Math.sqrt(Math.pow((i.getCords()[0] - n2.getCords()[0]), 2)
|
||||
+ Math.pow((i.getCords()[1] - n2.getCords()[1]), 2)) / 100;
|
||||
|
||||
// Berechne Distanz zu nächstem Knoten
|
||||
EdgeWeightMarking marking = (EdgeWeightMarking) j.getMarking();
|
||||
dist = distance.get(nextVertex.getElement()) + marking.getWeight();
|
||||
distToFinish = distance.get(nextVertex.getElement()) + marking.getWeight() + airDist;
|
||||
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);
|
||||
|
||||
// Logging
|
||||
textDescription = "Add " + i.getName() + " with " + distToFinish + " weight to queue.";
|
||||
System.out.println(textDescription);
|
||||
if (i.getScreenVertex().getColor() != Color.RED) {
|
||||
i.getScreenVertex().setColor(Color.YELLOW);
|
||||
}
|
||||
this.logList.add(new OurLogElement(step, textDescription, 0, this.getScreenGraphCopy()));
|
||||
|
||||
// Nehme nächsten Knoten in die Queue auf
|
||||
queue.add(new WrapperElement<>(i, distToFinish));
|
||||
}
|
||||
}
|
||||
|
||||
//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,5 +1,9 @@
|
||||
package graph;
|
||||
|
||||
/**
|
||||
* Represents a vertex in a graph.
|
||||
* This class serves as a base abstraction for vertices in various types of graphs.
|
||||
*/
|
||||
public abstract class Vertex {
|
||||
|
||||
// ATTRIBUTE
|
||||
@@ -9,11 +13,19 @@ public abstract class Vertex {
|
||||
|
||||
// KONSTRUKTOREN
|
||||
|
||||
/**
|
||||
* Constructs a vertex with an empty name.
|
||||
*/
|
||||
public Vertex() {
|
||||
this.name = "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a vertex with a specified name.
|
||||
*
|
||||
* @param s The name of the vertex.
|
||||
*/
|
||||
public Vertex(String s) {
|
||||
this.name = s;
|
||||
}
|
||||
@@ -21,16 +33,32 @@ public abstract class Vertex {
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Retrieves the name of the vertex.
|
||||
*
|
||||
* @return The name of the vertex.
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abstract method to retrieve the visualization representation of the vertex.
|
||||
* Concrete subclasses will provide specific implementations.
|
||||
*
|
||||
* @return The visualization representation of the vertex.
|
||||
*/
|
||||
public abstract visualizationElements.Vertex getScreenVertex();
|
||||
|
||||
|
||||
// SET-ER
|
||||
|
||||
/**
|
||||
* Sets the name of the vertex.
|
||||
*
|
||||
* @param s The new name for the vertex.
|
||||
*/
|
||||
public void setName(String s) {
|
||||
this.name = s;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,60 @@
|
||||
package graph;
|
||||
|
||||
/**
|
||||
* Represents a marking associated with a vertex in a graph.
|
||||
* This class serves as a base abstraction for vertex markings.
|
||||
*/
|
||||
public abstract class VertexMarking extends Marking {
|
||||
// This class currently does not have any additional attributes or methods.
|
||||
// It extends Marking, inheriting its properties and behaviors.
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Represents a weight marking associated with a vertex in a graph.
|
||||
* Extends {@link VertexMarking}.
|
||||
*/
|
||||
class VertexWeightMarking extends VertexMarking {
|
||||
|
||||
// ATTRIBUTE
|
||||
|
||||
private int weight;
|
||||
|
||||
|
||||
// KONSTRUKTOREN
|
||||
|
||||
/**
|
||||
* Constructs a vertex weight marking with the specified weight.
|
||||
*
|
||||
* @param weight The weight value associated with the vertex.
|
||||
*/
|
||||
VertexWeightMarking(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
|
||||
// GET-ER
|
||||
|
||||
/**
|
||||
* Retrieves the weight associated with this vertex weight marking.
|
||||
*
|
||||
* @return The weight of the vertex marking.
|
||||
*/
|
||||
public int getWeight() {
|
||||
return this.weight;
|
||||
}
|
||||
|
||||
|
||||
// SET-ER
|
||||
|
||||
/**
|
||||
* Sets the weight associated with this vertex weight marking.
|
||||
*
|
||||
* @param weight The new weight value to set.
|
||||
*/
|
||||
public void setWeight(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1
out/production/ProjektGraph/.gitignore
vendored
Normal file
1
out/production/ProjektGraph/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/out/
|
||||
11
out/production/ProjektGraph/.idea/ProjektGraph.iml
generated
Normal file
11
out/production/ProjektGraph/.idea/ProjektGraph.iml
generated
Normal 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>
|
||||
6
out/production/ProjektGraph/.idea/misc.xml
generated
Normal file
6
out/production/ProjektGraph/.idea/misc.xml
generated
Normal 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>
|
||||
8
out/production/ProjektGraph/.idea/modules.xml
generated
Normal file
8
out/production/ProjektGraph/.idea/modules.xml
generated
Normal 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>
|
||||
124
out/production/ProjektGraph/.idea/uiDesigner.xml
generated
Normal file
124
out/production/ProjektGraph/.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
6
out/production/ProjektGraph/.idea/vcs.xml
generated
Normal file
6
out/production/ProjektGraph/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
185
out/production/ProjektGraph/.idea/workspace.xml
generated
Normal file
185
out/production/ProjektGraph/.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,185 @@
|
||||
<?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="LegendArea gestaltet">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/OurApplication/OurLogElement.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurLogElement.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/OurApplication/OurTextArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/OurApplication/OurTextArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/graph/DirectedGraph.java" beforeDir="false" afterPath="$PROJECT_DIR$/graph/DirectedGraph.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurLogElement.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurLogElement.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurParameterArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurParameterArea.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurTextArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/OurApplication/OurTextArea.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/out/production/ProjektGraph/graph/DirectedGraph.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/ProjektGraph/graph/DirectedGraph.class" 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_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="ebd1173cbc514ede7aa65ba6be90702c92e0e8b4" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
<option name="RESET_MODE" value="HARD" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"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">{
|
||||
"keyToString": {
|
||||
"Application.Display.executor": "Run",
|
||||
"Application.OurApplication.executor": "Debug",
|
||||
"Application.OurLegendArea.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraphMain"
|
||||
}
|
||||
}</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>
|
||||
<task id="LOCAL-00001" summary="Stable Version 3.0">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720028543313</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720028543313</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00002" summary="Adding AStar Algorithm">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720036191925</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720036191926</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="Adding AStar Algorithm">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720036227325</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720036227325</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00004" summary="Adding AStar Algorithm">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720042374225</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720042374225</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00005" summary="Stable Version with finished visualisation">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720120737939</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720120737940</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00006" summary="Stable Version 3.0">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720182049903</created>
|
||||
<option name="number" value="00006" />
|
||||
<option name="presentableId" value="LOCAL-00006" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720182049903</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00007" summary="Tests with marking of Edges and Vertexes Adding Visualisation of Edge weight and Vertex name fixed AStar">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720291413659</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720291413659</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00008" summary="small fix">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720293774580</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720293774580</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00009" summary="Beispiele überarbeitet">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720311867957</created>
|
||||
<option name="number" value="00009" />
|
||||
<option name="presentableId" value="LOCAL-00009" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720311867957</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00010" summary="LegendArea gestaltet">
|
||||
<option name="closed" value="true" />
|
||||
<created>1720347450647</created>
|
||||
<option name="number" value="00010" />
|
||||
<option name="presentableId" value="LOCAL-00010" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1720347450647</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="11" />
|
||||
<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="Adding AStar Algorithm" />
|
||||
<MESSAGE value="Stable Version with finished visualisation" />
|
||||
<MESSAGE value="Stable Version 3.0" />
|
||||
<MESSAGE value="Tests with marking of Edges and Vertexes Adding Visualisation of Edge weight and Vertex name fixed AStar" />
|
||||
<MESSAGE value="small fix" />
|
||||
<MESSAGE value="Beispiele überarbeitet" />
|
||||
<MESSAGE value="LegendArea gestaltet" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="LegendArea gestaltet" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/OurApplication/OurApplication.java</url>
|
||||
<line>49</line>
|
||||
<option name="timeStamp" value="2" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
||||
BIN
out/production/ProjektGraph/OurApplication/OurAlgorithm.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurAlgorithm.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/OurApplication/OurApplication.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurApplication.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/OurApplication/OurDrawArea.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurDrawArea.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/OurApplication/OurHybridWindow.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurHybridWindow.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/OurApplication/OurLegendArea.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurLegendArea.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/OurApplication/OurLogElement.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurLogElement.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/OurApplication/OurTextArea.class
Normal file
BIN
out/production/ProjektGraph/OurApplication/OurTextArea.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/graph/DirectedGraph.class
Normal file
BIN
out/production/ProjektGraph/graph/DirectedGraph.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/Edge.class
Normal file
BIN
out/production/ProjektGraph/graph/Edge.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/EdgeMarking.class
Normal file
BIN
out/production/ProjektGraph/graph/EdgeMarking.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/EdgeWeightMarking.class
Normal file
BIN
out/production/ProjektGraph/graph/EdgeWeightMarking.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/ExampleGraphs.class
Normal file
BIN
out/production/ProjektGraph/graph/ExampleGraphs.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/Graph.class
Normal file
BIN
out/production/ProjektGraph/graph/Graph.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/MarkedEdge.class
Normal file
BIN
out/production/ProjektGraph/graph/MarkedEdge.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/MarkedVertex.class
Normal file
BIN
out/production/ProjektGraph/graph/MarkedVertex.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/Marking.class
Normal file
BIN
out/production/ProjektGraph/graph/Marking.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/graph/UndirectedGraph.class
Normal file
BIN
out/production/ProjektGraph/graph/UndirectedGraph.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/Vertex.class
Normal file
BIN
out/production/ProjektGraph/graph/Vertex.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/VertexMarking.class
Normal file
BIN
out/production/ProjektGraph/graph/VertexMarking.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/VertexWeightMarking.class
Normal file
BIN
out/production/ProjektGraph/graph/VertexWeightMarking.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/WrapperComparator.class
Normal file
BIN
out/production/ProjektGraph/graph/WrapperComparator.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/graph/WrapperElement.class
Normal file
BIN
out/production/ProjektGraph/graph/WrapperElement.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/logging/Algorithm.class
Normal file
BIN
out/production/ProjektGraph/logging/Algorithm.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/logging/LogElement.class
Normal file
BIN
out/production/ProjektGraph/logging/LogElement.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/logging/LogElementList.class
Normal file
BIN
out/production/ProjektGraph/logging/LogElementList.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualisation/DrawArea.class
Normal file
BIN
out/production/ProjektGraph/visualisation/DrawArea.class
Normal file
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.
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/visualisation/HybridWindow.class
Normal file
BIN
out/production/ProjektGraph/visualisation/HybridWindow.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualisation/LegendArea.class
Normal file
BIN
out/production/ProjektGraph/visualisation/LegendArea.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualisation/ParameterArea.class
Normal file
BIN
out/production/ProjektGraph/visualisation/ParameterArea.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualisation/TextArea.class
Normal file
BIN
out/production/ProjektGraph/visualisation/TextArea.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/BarChart.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/BarChart.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Cell.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Cell.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/DotChart.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/DotChart.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Edge.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Edge.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Graph.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Graph.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/List.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/List.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Maze.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Maze.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Queue.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Queue.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Stack.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Stack.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Table.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Table.class
Normal file
Binary file not shown.
BIN
out/production/ProjektGraph/visualizationElements/Vertex.class
Normal file
BIN
out/production/ProjektGraph/visualizationElements/Vertex.class
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user