Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
77f209b2aa | |
|
245b235d43 | |
|
a2040c3afe |
|
@ -24,3 +24,6 @@
|
||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_pid*
|
replay_pid*
|
||||||
|
|
||||||
|
/bin/
|
||||||
|
/.classpath
|
||||||
|
/.project
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,146 @@
|
||||||
|
Stadt1,Stadt2,Entfernung_km
|
||||||
|
Berlin,Potsdam,35
|
||||||
|
Berlin,Cottbus,125 # A13/A15 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Berlin,Rostock,230 # A24/A19 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Berlin,Schwerin,215 # A24 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Hamburg,Bremen,125 # A1 ohne Ausfahrt zu anderer Großstadt dazwischen (Wildeshausen etc. kleiner)
|
||||||
|
Hamburg,Lübeck,65 # A1 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Hamburg,Kiel,95 # A7/A215 ohne Ausfahrt zu anderer Großstadt dazwischen (Neumünster <100k)
|
||||||
|
Hamburg,Hannover,155 # A7 ohne Ausfahrt zu anderer Großstadt dazwischen (Soltau etc. kleiner)
|
||||||
|
Hamburg,Rostock,190 # A1/A20 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Hamburg,Schwerin,115 # A24 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
München,Augsburg,65 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
München,Ingolstadt,80 # A9 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
München,Regensburg,125 # A9/A93 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
München,Ulm,155 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
München,Rosenheim,60 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen (Rosenheim <100k)
|
||||||
|
München,Landshut,75 # A92 ohne Ausfahrt zu anderer Großstadt dazwischen (Landshut <100k)
|
||||||
|
Köln,Bonn,30 # A555 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Köln,Leverkusen,15 # Kurze Verbindung, A3/A1 Stücke
|
||||||
|
Köln,Bergisch Gladbach,15 # Direkte Nachbarschaft / Landstraße
|
||||||
|
Köln,Aachen,70 # A4 ohne Ausfahrt zu anderer Großstadt dazwischen (Düren <100k)
|
||||||
|
Köln,Siegen,95 # A4 ohne Ausfahrt zu anderer Großstadt dazwischen (Olpe etc. <100k)
|
||||||
|
Frankfurt am Main,Wiesbaden,40 # A66
|
||||||
|
Frankfurt am Main,Mainz,45 # A66/A60
|
||||||
|
Frankfurt am Main,Darmstadt,35 # A5/A67
|
||||||
|
Frankfurt am Main,Offenbach am Main,10 # Direkte Nachbarschaft
|
||||||
|
Frankfurt am Main,Hanau,25 # A66 (Hanau oft >100k)
|
||||||
|
Frankfurt am Main,Gießen,65 # A5 ohne Ausfahrt zu anderer Großstadt dazwischen (Bad Homburg etc. <100k)
|
||||||
|
Frankfurt am Main,Koblenz,125 # A3 ohne Ausfahrt zu anderer Großstadt dazwischen (Limburg <100k)
|
||||||
|
Frankfurt am Main,Kassel,190 # A5/A7 ohne Ausfahrt zu anderer Großstadt dazwischen (Gießen wird passiert, Fulda <100k)
|
||||||
|
Stuttgart,Heilbronn,55 # A81 ohne Ausfahrt zu anderer Großstadt dazwischen (Ludwigsburg <100k)
|
||||||
|
Stuttgart,Pforzheim,50 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen (Leonberg <100k)
|
||||||
|
Stuttgart,Reutlingen,40 # B27/B464 (Reutlingen >100k)
|
||||||
|
Stuttgart,Ulm,95 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen (Esslingen/Göppingen <100k)
|
||||||
|
Düsseldorf,Krefeld,25 # Kurze A44/A57 Stücke
|
||||||
|
Düsseldorf,Mönchengladbach,30 # A46/A52
|
||||||
|
Düsseldorf,Neuss,10 # Direkte Nachbarschaft (Neuss <100k)
|
||||||
|
Düsseldorf,Solingen,30 # Kurze A46/A3/Landstraßen
|
||||||
|
Düsseldorf,Wuppertal,35 # A46 ohne Ausfahrt zu anderer Großstadt dazwischen (Hilden/Erkrath <100k)
|
||||||
|
Leipzig,Halle (Saale),40 # A14/B6 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Leipzig,Jena,95 # A9/A4 ohne Ausfahrt zu anderer Großstadt dazwischen (Naumburg etc. <100k)
|
||||||
|
Leipzig,Chemnitz,90 # A14/A72 ohne Ausfahrt zu anderer Großstadt dazwischen (Altenburg etc. <100k)
|
||||||
|
Dortmund,Hamm,40 # A2 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Dortmund,Hagen,20 # Direkte Nachbarschaft / A45
|
||||||
|
Dortmund,Münster,65 # A1 ohne Ausfahrt zu anderer Großstadt dazwischen (Unna etc. <100k)
|
||||||
|
Essen,Oberhausen,15 # Kurze Verbindung A40/A42/Stadtgebiet
|
||||||
|
Essen,Mülheim an der Ruhr,10 # Direkte Nachbarschaft
|
||||||
|
Essen,Bottrop,15 # Direkte Nachbarschaft
|
||||||
|
Essen,Gelsenkirchen,15 # Direkte Nachbarschaft / A42
|
||||||
|
Bremen,Oldenburg,50 # A28 ohne Ausfahrt zu anderer Großstadt dazwischen (Delmenhorst >100k wird direkt passiert - GRENZFALL, aber wohl eher ja)
|
||||||
|
Bremen,Bremerhaven,65 # Bremerhaven <100k
|
||||||
|
Bremen,Osnabrück,120 # A1 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Dresden,Chemnitz,80 # A4 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Dresden,Cottbus,115 # A4/A13/A15 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Hannover,Braunschweig,65 # A2 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Hannover,Hildesheim,35 # B6/A7
|
||||||
|
Hannover,Salzgitter,55 # A7/A39
|
||||||
|
Hannover,Kassel,170 # A7 ohne Ausfahrt zu anderer Großstadt dazwischen (Göttingen wird passiert)
|
||||||
|
Nürnberg,Fürth,10 # Direkte Nachbarschaft (Fürth >100k)
|
||||||
|
Nürnberg,Erlangen,20 # Direkte Nachbarschaft / A73
|
||||||
|
Nürnberg,Ingolstadt,90 # A9 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Nürnberg,Regensburg,110 # A3 ohne Ausfahrt zu anderer Großstadt dazwischen (Neumarkt <100k)
|
||||||
|
Duisburg,Oberhausen,10 # Direkte Nachbarschaft / A3/A42
|
||||||
|
Duisburg,Moers,10 # Direkte Nachbarschaft / A40
|
||||||
|
Duisburg,Mülheim an der Ruhr,15 # Direkte Nachbarschaft
|
||||||
|
Duisburg,Krefeld,25 # A40/A57 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Bochum,Herne,10 # Direkte Nachbarschaft (Herne >100k)
|
||||||
|
Bochum,Gelsenkirchen,15 # Direkte Nachbarschaft / Stadtstraßen
|
||||||
|
Bochum,Witten,10 # Witten <100k
|
||||||
|
Wuppertal,Solingen,20 # Direkte Nachbarschaft / Landstraßen (Solingen >100k)
|
||||||
|
Wuppertal,Remscheid,15 # Direkte Nachbarschaft (Remscheid >100k)
|
||||||
|
Bielefeld,Gütersloh,15 # Direkte Nachbarschaft (Gütersloh >100k)
|
||||||
|
Bielefeld,Paderborn,50 # Paderborn <100k
|
||||||
|
Bielefeld,Osnabrück,50 # A33 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Bonn,Koblenz,60 # B9/A61 ohne Ausfahrt zu anderer Großstadt dazwischen (Andernach etc. <100k)
|
||||||
|
Münster,Osnabrück,50 # A1 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Münster,Hamm,40 # B63/A1
|
||||||
|
Münster,Recklinghausen,55 # A43 ohne Ausfahrt zu anderer Großstadt dazwischen (Dülmen etc. <100k)
|
||||||
|
Karlsruhe,Pforzheim,30 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen (Pforzheim >100k)
|
||||||
|
Karlsruhe,Heidelberg,55 # A5 ohne Ausfahrt zu anderer Großstadt dazwischen (Bruchsal <100k)
|
||||||
|
Karlsruhe,Mannheim,60 # A5/A656 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Mannheim,Ludwigshafen am Rhein,5 # Direkte Nachbarschaft
|
||||||
|
Mannheim,Heidelberg,20 # Direkte Nachbarschaft / L600/A656
|
||||||
|
Mannheim,Darmstadt,60 # A67/A5 ohne Ausfahrt zu anderer Großstadt dazwischen (Heppenheim etc. <100k)
|
||||||
|
Augsburg,Ingolstadt,80 # B300/A9 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Augsburg,Ulm,85 # A8 ohne Ausfahrt zu anderer Großstadt dazwischen (Günzburg <100k)
|
||||||
|
Wiesbaden,Mainz,15 # Direkte Nachbarschaft
|
||||||
|
Wiesbaden,Koblenz,95 # A66/A3 ohne Ausfahrt zu anderer Großstadt dazwischen (Limburg <100k)
|
||||||
|
Wiesbaden,Darmstadt,45 # A671/A60/A67 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Gelsenkirchen,Herne,10 # Direkte Nachbarschaft
|
||||||
|
Gelsenkirchen,Recklinghausen,15 # Direkte Nachbarschaft
|
||||||
|
Mönchengladbach,Krefeld,25 # A44/A52
|
||||||
|
Mönchengladbach,Neuss,25 # A46/A57 (Neuss <100k)
|
||||||
|
Braunschweig,Wolfsburg,35 # A39/A2
|
||||||
|
Braunschweig,Salzgitter,25 # A39
|
||||||
|
Braunschweig,Magdeburg,105 # A2 ohne Ausfahrt zu anderer Großstadt dazwischen (Helmstedt <100k)
|
||||||
|
Chemnitz,Zwickau,40 # A72/A4 (Zwickau >100k)
|
||||||
|
Chemnitz,Jena,95 # A4 ohne Ausfahrt zu anderer Großstadt dazwischen (Gera wird passiert)
|
||||||
|
Kiel,Lübeck,85 # A21/A1
|
||||||
|
Kiel,Neumünster,35 # Neumünster <100k
|
||||||
|
Aachen,Mönchengladbach,65 # A44/A46 ohne Ausfahrt zu anderer Großstadt dazwischen (Erkelenz etc. <100k)
|
||||||
|
Halle (Saale),Jena,80 # A9/A4 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Magdeburg,Wolfsburg,75 # B188/A2
|
||||||
|
Freiburg im Breisgau,Karlsruhe,135 # A5 ohne Ausfahrt zu anderer Großstadt dazwischen (Offenburg <100k)
|
||||||
|
Freiburg im Breisgau,Offenburg,65 # Offenburg <100k
|
||||||
|
Krefeld,Moers,20 # Direkte Nachbarschaft / A57
|
||||||
|
Lübeck,Schwerin,70 # A20 ohne Ausfahrt zu anderer Großstadt dazwischen (Wismar <100k)
|
||||||
|
Oberhausen,Bottrop,5 # Direkte Nachbarschaft
|
||||||
|
Erfurt,Jena,50 # A4
|
||||||
|
Erfurt,Gotha,30 # Gotha <100k
|
||||||
|
Erfurt,Weimar,25 # Weimar <100k
|
||||||
|
Mainz,Darmstadt,40 # A60/A67
|
||||||
|
Mainz,Ludwigshafen am Rhein,80 # A60/A63/A61 ohne Ausfahrt zu anderer Großstadt dazwischen (Worms/Alzey <100k)
|
||||||
|
Mainz,Koblenz,100 # A60/A61 ohne Ausfahrt zu anderer Großstadt dazwischen (Bingen <100k)
|
||||||
|
Rostock,Schwerin,85 # A20
|
||||||
|
Kassel,Göttingen,55 # A7 (Göttingen >100k)
|
||||||
|
Kassel,Paderborn,85 # A44 (Paderborn <100k)
|
||||||
|
Kassel,Fulda,105 # A7 (Fulda <100k)
|
||||||
|
Hagen,Hamm,45 # A1
|
||||||
|
Hagen,Witten,15 # Witten <100k
|
||||||
|
Saarbrücken,Trier,100 # A1/A62 ohne Ausfahrt zu anderer Großstadt dazwischen (Nonnweiler etc. <100k)
|
||||||
|
Saarbrücken,Kaiserslautern,70 # A6 (Kaiserslautern >100k)
|
||||||
|
Mülheim an der Ruhr,Oberhausen,5 # Direkte Nachbarschaft
|
||||||
|
Potsdam,Magdeburg,110 # A10/A2 ohne Ausfahrt zu anderer Großstadt dazwischen (Brandenburg <100k)
|
||||||
|
Ludwigshafen am Rhein,Heidelberg,25 # A650/A656
|
||||||
|
Ludwigshafen am Rhein,Speyer,20 # Speyer <100k
|
||||||
|
Ludwigshafen am Rhein,Kaiserslautern,60 # A6/A61 ohne Ausfahrt zu anderer Großstadt dazwischen (Bad Dürkheim <100k)
|
||||||
|
Oldenburg,Osnabrück,110 # A29/A1 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Leverkusen,Solingen,20 # Kurze Verbindung A3/A1/Landstr.
|
||||||
|
Osnabrück,Rheine,40 # Rheine <100k
|
||||||
|
Heidelberg,Heilbronn,50 # A6 ohne Ausfahrt zu anderer Großstadt dazwischen (Sinsheim <100k)
|
||||||
|
Regensburg,Ingolstadt,75 # A93
|
||||||
|
Ingolstadt,Ulm,140 # B16/A8 - sehr lange B-Straße, A8 ohne Ausfahrt zu anderer Großstadt dazwischen
|
||||||
|
Würzburg,Heilbronn,85 # A81 ohne Ausfahrt zu anderer Großstadt dazwischen (Tauberbischofsheim <100k)
|
||||||
|
Würzburg,Fulda,105 # A7
|
||||||
|
Ulm,Heidenheim an der Brenz,35 # Heidenheim <100k
|
||||||
|
Heilbronn,Pforzheim,60 # B293/A8
|
||||||
|
Göttingen,Hildesheim,90 # A7
|
||||||
|
Recklinghausen,Herne,10 # Direkte Nachbarschaft
|
||||||
|
Koblenz,Trier,125 # A48/A1 ohne Ausfahrt zu anderer Großstadt dazwischen (Wittlich <100k)
|
||||||
|
Bergisch Gladbach,Siegen,80 # A4
|
||||||
|
Jena,Gera,40 # A4 (Gera >100k)
|
||||||
|
Erlangen,Bamberg,45 # Bamberg <100k
|
||||||
|
Moers,Krefeld,20 # Direkte Nachbarschaft / A40/A57
|
||||||
|
Siegen,Gießen,70 # A45 ohne Ausfahrt zu anderer Großstadt dazwischen (Wetzlar <100k)
|
||||||
|
Hildesheim,Salzgitter,30 # A7/A39/B6
|
File diff suppressed because it is too large
Load Diff
|
@ -1,214 +0,0 @@
|
||||||
Aachen
|
|
||||||
Köln
|
|
||||||
Trier
|
|
||||||
|
|
||||||
Augsburg
|
|
||||||
München
|
|
||||||
Garmisch-Part.
|
|
||||||
Nürnberg
|
|
||||||
Ulm
|
|
||||||
Regensburg
|
|
||||||
Lindau
|
|
||||||
|
|
||||||
Bayreuth
|
|
||||||
Nürnberg
|
|
||||||
Würzburg
|
|
||||||
Erfurt
|
|
||||||
|
|
||||||
Berlin
|
|
||||||
Cottbus
|
|
||||||
Leipzig
|
|
||||||
Frankfurt/Oder
|
|
||||||
Magdeburg
|
|
||||||
Schwerin
|
|
||||||
Rostock
|
|
||||||
Magdeburg
|
|
||||||
Neubrandenburg
|
|
||||||
|
|
||||||
Bremen
|
|
||||||
Hamburg
|
|
||||||
Hannover
|
|
||||||
Osnabrück
|
|
||||||
|
|
||||||
Cottbus
|
|
||||||
Dresden
|
|
||||||
Frankfurt/Oder
|
|
||||||
Berlin
|
|
||||||
|
|
||||||
Dresden
|
|
||||||
Cottbus
|
|
||||||
Erfurt
|
|
||||||
Bayreuth
|
|
||||||
|
|
||||||
Erfurt
|
|
||||||
Magdeburg
|
|
||||||
Fulda
|
|
||||||
Bayreuth
|
|
||||||
Kassel
|
|
||||||
|
|
||||||
Essen
|
|
||||||
Köln
|
|
||||||
Münster
|
|
||||||
Kassel
|
|
||||||
|
|
||||||
Frankfurt/Main
|
|
||||||
Mannheim
|
|
||||||
Würzburg
|
|
||||||
Koblenz
|
|
||||||
Fulda
|
|
||||||
Kassel
|
|
||||||
|
|
||||||
Frankfurt/Oder
|
|
||||||
Dresden
|
|
||||||
Berlin
|
|
||||||
|
|
||||||
Freiburg
|
|
||||||
Karlsruhe
|
|
||||||
Stuttgart
|
|
||||||
Lindau
|
|
||||||
|
|
||||||
Fulda
|
|
||||||
Kassel
|
|
||||||
Erfurt
|
|
||||||
Würzburg
|
|
||||||
|
|
||||||
Garmisch-Part.
|
|
||||||
München
|
|
||||||
Lindau
|
|
||||||
Ulm
|
|
||||||
|
|
||||||
Hamburg
|
|
||||||
Kiel
|
|
||||||
Bremen
|
|
||||||
Magdeburg
|
|
||||||
|
|
||||||
Hannover
|
|
||||||
Osnabrück
|
|
||||||
Bremen
|
|
||||||
Hamburg
|
|
||||||
Magdeburg
|
|
||||||
|
|
||||||
Karlsruhe
|
|
||||||
Stuttgart
|
|
||||||
Mannheim
|
|
||||||
Saarbrücken
|
|
||||||
|
|
||||||
Kassel
|
|
||||||
Frankfurt/Main
|
|
||||||
Essen
|
|
||||||
Fulda
|
|
||||||
Erfurt
|
|
||||||
|
|
||||||
Kiel
|
|
||||||
Hamburg
|
|
||||||
Schwerin
|
|
||||||
|
|
||||||
Koblenz
|
|
||||||
Köln
|
|
||||||
Trier
|
|
||||||
Frankfurt/Main
|
|
||||||
Fulda
|
|
||||||
Kassel
|
|
||||||
|
|
||||||
Köln
|
|
||||||
Koblenz
|
|
||||||
Trier
|
|
||||||
|
|
||||||
Leipzig
|
|
||||||
Berlin
|
|
||||||
Erfurt
|
|
||||||
Magdeburg
|
|
||||||
|
|
||||||
Lindau
|
|
||||||
Ulm
|
|
||||||
Garmisch-Part.
|
|
||||||
|
|
||||||
Magdeburg
|
|
||||||
Hannover
|
|
||||||
Berlin
|
|
||||||
Schwerin
|
|
||||||
Hamburg
|
|
||||||
|
|
||||||
Mannheim
|
|
||||||
Karlsruhe
|
|
||||||
Frankfurt/Main
|
|
||||||
Saarbrücken
|
|
||||||
Trier
|
|
||||||
Koblenz
|
|
||||||
|
|
||||||
München
|
|
||||||
Augsburg
|
|
||||||
Lindau
|
|
||||||
Bayreuth
|
|
||||||
Würzburg
|
|
||||||
Passau
|
|
||||||
|
|
||||||
Münster
|
|
||||||
Osnabrück
|
|
||||||
Essen
|
|
||||||
|
|
||||||
Neubrandenburg
|
|
||||||
Berlin
|
|
||||||
Rostock
|
|
||||||
Schwerin
|
|
||||||
|
|
||||||
Nürnberg
|
|
||||||
München
|
|
||||||
Würzburg
|
|
||||||
Bayreuth
|
|
||||||
Stuttgart
|
|
||||||
|
|
||||||
Osnabrück
|
|
||||||
Hannover
|
|
||||||
Kassel
|
|
||||||
Münster
|
|
||||||
Bremen
|
|
||||||
Wilhelmshaven
|
|
||||||
|
|
||||||
Passau
|
|
||||||
Regensburg
|
|
||||||
München
|
|
||||||
|
|
||||||
Regensburg
|
|
||||||
Nürnberg
|
|
||||||
München
|
|
||||||
Passau
|
|
||||||
|
|
||||||
Rostock
|
|
||||||
Schwerin
|
|
||||||
Neubrandenburg
|
|
||||||
|
|
||||||
Saarbrücken
|
|
||||||
Trier
|
|
||||||
Mannheim
|
|
||||||
Frankfurt/Main
|
|
||||||
Karlsruhe
|
|
||||||
|
|
||||||
Schwerin
|
|
||||||
Rostock
|
|
||||||
Hamburg
|
|
||||||
Berlin
|
|
||||||
|
|
||||||
Stuttgart
|
|
||||||
Karlsruhe
|
|
||||||
Ulm
|
|
||||||
Würzburg
|
|
||||||
|
|
||||||
Trier
|
|
||||||
Saarbrücken
|
|
||||||
Koblenz
|
|
||||||
|
|
||||||
Ulm
|
|
||||||
Stuttgart
|
|
||||||
Augsburg
|
|
||||||
Lindau
|
|
||||||
Nürnberg
|
|
||||||
Würzburg
|
|
||||||
|
|
||||||
Wilhelmshaven
|
|
||||||
Bremen
|
|
||||||
Osnabrück
|
|
||||||
|
|
||||||
Würzburg
|
|
||||||
Osnabrück
|
|
||||||
Bremen
|
|
|
@ -1,18 +1,23 @@
|
||||||
package de.th_mannheim.informatik.routenplaner;
|
package de.th_mannheim.informatik.routenplaner;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
import de.th_mannheim.informatik.routenplaner.domain.Routeplaner;
|
import de.th_mannheim.informatik.routenplaner.domain.Routeplaner;
|
||||||
|
|
||||||
public class NaviApp {
|
public class NaviApp {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
Routeplaner map = new Routeplaner();
|
Routeplaner map = new Routeplaner();
|
||||||
|
|
||||||
System.out.println();
|
System.out.println(map.getNumberOfCities() + " Städte enthalten.");
|
||||||
System.out.println(map.getNumberOfCities());
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
for (String waypoint : map.initializePlanning("Mannheim", "Wilhelmshaven"))
|
Stack<String> route = map.planRoute("Mannheim", "Lübeck");
|
||||||
System.out.println(waypoint);
|
|
||||||
|
System.out.println();
|
||||||
|
System.out.println("Gefundene Route:");
|
||||||
|
while (!route.isEmpty())
|
||||||
|
System.out.println(route.pop());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,58 +1,80 @@
|
||||||
package de.th_mannheim.informatik.routenplaner.domain;
|
package de.th_mannheim.informatik.routenplaner.domain;
|
||||||
|
|
||||||
import java.util.TreeSet;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class City {
|
public class City implements Comparable<City>{
|
||||||
private String name;
|
private String name;
|
||||||
private int distance;
|
private int distance;
|
||||||
private String predecessor;
|
private boolean explored;
|
||||||
|
private City predecessor;
|
||||||
|
|
||||||
private TreeSet<Street> neighbors = new TreeSet<>();
|
private LinkedList<Road> neighbors = new LinkedList<>();
|
||||||
|
|
||||||
public City(String name) {
|
public City(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addConnection(City stadt2, int distance) {
|
public void addConnection(City stadt2, int distance) {
|
||||||
neighbors.add(new Street(this, stadt2, distance));
|
neighbors.add(new Road(this, stadt2, distance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeSet<Street> getNeighbors() {
|
public LinkedList<Road> getConnections() {
|
||||||
return neighbors;
|
return neighbors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAndChangeDistance(int distance, String predecessor) {
|
public void reset() {
|
||||||
if (distance < this.distance) {
|
distance = Integer.MAX_VALUE;
|
||||||
this.distance = distance;
|
explored = false;
|
||||||
this.predecessor = predecessor;
|
predecessor = null;
|
||||||
System.out.println(name + " " + distance + " <- " + predecessor);
|
|
||||||
|
|
||||||
for (Street s : neighbors) {
|
|
||||||
s.setUnused();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDistance() {
|
public int getDistance() {
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistance(int distance) {
|
public void checkAndSetDistance(City start, City target, int value) {
|
||||||
this.distance = distance;
|
if (this.distance > value) {
|
||||||
|
this.distance = value;
|
||||||
|
target.setPredecessor(start);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPredecessor() {
|
public boolean isExplored() {
|
||||||
|
return explored;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExplored() {
|
||||||
|
explored = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPredecessor(City predecessor) {
|
||||||
|
this.predecessor = predecessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public City getPredecessor() {
|
||||||
return predecessor;
|
return predecessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reset() {
|
@Override
|
||||||
distance = Integer.MAX_VALUE;
|
public int compareTo(City other) {
|
||||||
predecessor = null;
|
int diff = this.distance - other.distance;
|
||||||
|
|
||||||
|
if (this == other)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (diff != 0)
|
||||||
|
return diff;
|
||||||
|
|
||||||
|
// if two Cities happen to have the same distance, sort alphabetically
|
||||||
|
return this.name.compareTo(other.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return name + " " + distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package de.th_mannheim.informatik.routenplaner.domain;
|
||||||
|
|
||||||
|
public class Road {
|
||||||
|
private final City start;
|
||||||
|
private final City destination;
|
||||||
|
|
||||||
|
private final int distance;
|
||||||
|
|
||||||
|
public Road(City start, City destination, int distance) {
|
||||||
|
this.start = start;
|
||||||
|
this.destination = destination;
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public City getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public City getDestination() {
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return start.getName() + " -> " + destination.getName() + ": " + distance + " km";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,177 +1,101 @@
|
||||||
package de.th_mannheim.informatik.routenplaner.domain;
|
package de.th_mannheim.informatik.routenplaner.domain;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.FileNotFoundException;
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
import java.util.Stack;
|
||||||
import org.jsoup.Jsoup;
|
import java.util.TreeSet;
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.select.Elements;
|
|
||||||
|
|
||||||
public class Routeplaner {
|
public class Routeplaner {
|
||||||
private HashMap<String, City> cities = new HashMap<>();
|
private HashMap<String, City> cities = new HashMap<>();
|
||||||
|
|
||||||
public Routeplaner() {
|
public Routeplaner() throws FileNotFoundException {
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Deque<String> initializePlanning(String start, String destination) {
|
|
||||||
cities.get(start).setDistance(0);
|
|
||||||
|
|
||||||
planRoute(start, destination);
|
|
||||||
|
|
||||||
System.out.println();
|
|
||||||
System.out.println();
|
|
||||||
System.out.println("Route:");
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
Deque<String> hops = new ArrayDeque<>();
|
|
||||||
City dc = cities.get(destination);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
hops.push(dc.getName() + " " + dc.getDistance() + " km");
|
|
||||||
|
|
||||||
if (dc.getName().equals(start))
|
|
||||||
break;
|
|
||||||
|
|
||||||
dc = cities.get(dc.getPredecessor());
|
|
||||||
}
|
|
||||||
|
|
||||||
return hops;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void planRoute(String start, String destination) {
|
|
||||||
System.out.println("Prüfe " + start);
|
|
||||||
City sc = cities.get(start);
|
|
||||||
|
|
||||||
if (sc == null || cities.get(destination) == null)
|
|
||||||
throw new RuntimeException("Stadt nicht gefunden.");
|
|
||||||
|
|
||||||
for (Street s : sc.getNeighbors()) {
|
|
||||||
if (s.isUsed())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
s.setUsed();
|
|
||||||
|
|
||||||
System.out.println(s.toString());
|
|
||||||
|
|
||||||
City nc = s.getDestination();
|
|
||||||
|
|
||||||
nc.checkAndChangeDistance(sc.getDistance() + s.getDistance(), sc.getName());
|
|
||||||
|
|
||||||
if (nc.getName().equals(destination)) {
|
|
||||||
System.out.println("Route nach " + destination + " gefunden mit Entfernung: " + nc.getDistance());
|
|
||||||
} else {
|
|
||||||
System.out.println();
|
|
||||||
planRoute(nc.getName(), destination);
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getNumberOfCities() {
|
public int getNumberOfCities() {
|
||||||
return cities.size();
|
return cities.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadData() {
|
public Stack<String> planRoute(String start, String destination) {
|
||||||
final String CITIES_DOCUMENT_PATH = "Routenplaner/resources/etab.html";
|
TreeSet<City> candidates = new TreeSet<>();
|
||||||
|
|
||||||
int[][] matrix;
|
City startCity = cities.get(start);
|
||||||
HashMap<String, Integer> cityLookup = new HashMap<>();
|
startCity.checkAndSetDistance(startCity, startCity, 0);
|
||||||
|
candidates.add(startCity);
|
||||||
File input = new File(CITIES_DOCUMENT_PATH);
|
|
||||||
Document doc;
|
// ---------------------------------------
|
||||||
try {
|
|
||||||
doc = Jsoup.parse(input, "UTF-8");
|
// iterate over graph
|
||||||
|
while (!candidates.isEmpty()) {
|
||||||
String[] cities = parseCities(doc);
|
City current = candidates.removeFirst();
|
||||||
matrix = new int[cities.length][cities.length];
|
|
||||||
|
this.processCandidates(current, candidates);
|
||||||
Elements cells = doc.select("td");
|
current.setExplored();
|
||||||
int xIndex = 0;
|
}
|
||||||
int yIndex = -1;
|
|
||||||
|
Stack<String> waypoints = new Stack<>();
|
||||||
for (int i = cities.length + 1; i < cells.size(); i++) {
|
City waypoint = cities.get(destination);
|
||||||
if(i%(cities.length + 1) == 0) {
|
while (!waypoint.getName().equals(start)) {
|
||||||
xIndex = 0;
|
waypoints.add(waypoint.toString());
|
||||||
yIndex++;
|
waypoint = waypoint.getPredecessor();
|
||||||
|
}
|
||||||
this.addCity(cities[yIndex]);
|
waypoints.add(waypoint.toString());
|
||||||
cityLookup.put(cities[yIndex], yIndex);
|
|
||||||
|
return waypoints;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
private void processCandidates(City start, TreeSet<City> candidates) {
|
||||||
String cityName1 = cities[xIndex];
|
for (Road r : start.getConnections()) {
|
||||||
String cityName2 = cities[yIndex];
|
City other = r.getDestination();
|
||||||
|
if (other.isExplored())
|
||||||
xIndex++;
|
continue;
|
||||||
|
|
||||||
if(cityName1.equals(cityName2))
|
other.checkAndSetDistance(start, other, start.getDistance() + r.getDistance());
|
||||||
continue;
|
candidates.add(other);
|
||||||
|
|
||||||
matrix[xIndex - 1][yIndex] = Integer.parseInt(cells.get(i).text());
|
|
||||||
} // for
|
|
||||||
|
|
||||||
loadConnections(matrix, cityLookup);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConnections(int[][] matrix, HashMap<String, Integer> cityLookup) throws IOException {
|
private void loadData() throws FileNotFoundException {
|
||||||
final Scanner sc = new Scanner(new File("Routenplaner/resources/verb.txt"));
|
final Scanner sc = new Scanner(new File("Routenplaner/resources/entfernungen.txt"));
|
||||||
|
|
||||||
String start = null;
|
sc.nextLine(); // skip column headers
|
||||||
|
|
||||||
while (sc.hasNextLine()) {
|
while (sc.hasNextLine()) {
|
||||||
String line = sc.nextLine();
|
String line = sc.nextLine();
|
||||||
|
|
||||||
if (start == null) {
|
// remove comments
|
||||||
start = line;
|
int comment = line.indexOf("#");
|
||||||
continue;
|
if (comment > -1)
|
||||||
}
|
line = line.substring(0, comment -1).trim();
|
||||||
|
|
||||||
|
String[] cols = line.split(",");
|
||||||
|
|
||||||
if (line.isBlank()) {
|
this.addStreet(cols[0], cols[1], Integer.parseInt(cols[2]));
|
||||||
start = null;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(start + " " + line + " " + matrix[cityLookup.get(start)][cityLookup.get(line)]);
|
|
||||||
this.addStreet(start, line, matrix[cityLookup.get(start)][cityLookup.get(line)]);
|
|
||||||
|
|
||||||
} // while
|
} // while
|
||||||
|
|
||||||
sc.close();
|
sc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] parseCities(Document doc) {
|
|
||||||
Elements cities = doc.select("td > b");
|
|
||||||
int cityAmount = cities.size();
|
|
||||||
String[] cityNames = new String[cityAmount];
|
|
||||||
|
|
||||||
for (int i = 0; i < cities.size(); i++) {
|
|
||||||
cityNames[i] = cities.get(i).text();
|
|
||||||
}
|
|
||||||
return cityNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addCity(String name) {
|
|
||||||
cities.put(name, new City(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addStreet(String name1, String name2, int distance) {
|
private void addStreet(String name1, String name2, int distance) {
|
||||||
City s1 = cities.get(name1);
|
City c1 = cities.get(name1);
|
||||||
City s2 = cities.get(name2);
|
if (c1 == null) {
|
||||||
|
c1 = new City(name1);
|
||||||
|
cities.put(name1, c1);
|
||||||
|
}
|
||||||
|
|
||||||
|
City c2 = cities.get(name2);
|
||||||
|
if (c2 == null) {
|
||||||
|
c2 = new City(name2);
|
||||||
|
cities.put(name2, c2);
|
||||||
|
}
|
||||||
|
|
||||||
s1.addConnection(s2, distance);
|
// all roads go in both directions
|
||||||
s2.addConnection(s1, distance);
|
c1.addConnection(c2, distance);
|
||||||
|
c2.addConnection(c1, distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package de.th_mannheim.informatik.routenplaner.domain;
|
|
||||||
|
|
||||||
public class Street implements Comparable<Street> {
|
|
||||||
private final City start;
|
|
||||||
private final City destination;
|
|
||||||
|
|
||||||
private final int distance;
|
|
||||||
private boolean used;
|
|
||||||
|
|
||||||
|
|
||||||
public Street(City start, City destination, int distance) {
|
|
||||||
super();
|
|
||||||
this.start = start;
|
|
||||||
this.destination = destination;
|
|
||||||
this.distance = distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Street v) {
|
|
||||||
int diff = this.distance - v.distance;
|
|
||||||
|
|
||||||
if (diff != 0)
|
|
||||||
return diff;
|
|
||||||
|
|
||||||
if (this.start.equals(v.start) && this.destination.equals(v.destination))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// wg. Nutzung von TreeSet
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public City getStart() {
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public City getDestination() {
|
|
||||||
return destination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDistance() {
|
|
||||||
return distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUsed() {
|
|
||||||
return used;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsed() {
|
|
||||||
used = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnused() {
|
|
||||||
used = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return start.getName() + " -> " + destination.getName() + ": " + distance + " km";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue