Compare commits
No commits in common. "963cdbad2b6c25c93421fe6cffef479573941a08" and "f5fa33e182fc862c74d00d2065db1213a66c399f" have entirely different histories.
963cdbad2b
...
f5fa33e182
|
@ -13,7 +13,6 @@ public class Auto {
|
|||
|
||||
public double getCO2AusstoßProKm() {
|
||||
return co2AusstossProKm;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,5 @@ public class Ort {
|
|||
|
||||
public double getLängengrad() {
|
||||
return längengrad;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ public class Reiseplanung {
|
|||
|
||||
public double getEntferung() {
|
||||
return entfernung;
|
||||
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
|
|
@ -11,7 +11,6 @@ public class User {
|
|||
|
||||
public User(String username, String password, Ort heimatstandort, Auto auto, double durchschnittsgeschwindigkeitPKW,
|
||||
double durchschnittsgeschwindigkeitFahrrad) {
|
||||
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.heimatstandort = heimatstandort;
|
||||
|
|
|
@ -7,45 +7,41 @@ import java.util.Scanner;
|
|||
import java.util.Set;
|
||||
|
||||
import domain.Ort;
|
||||
import domain.Reiseplanung;
|
||||
import domain.User;
|
||||
import ui.UserInterface;
|
||||
|
||||
public class ReiseFassade {
|
||||
|
||||
User user;
|
||||
private Set<Ort> orte;
|
||||
|
||||
public ReiseFassade(User user) throws FileNotFoundException {
|
||||
|
||||
public ReiseFassade() throws FileNotFoundException {
|
||||
orte = new HashSet<>();
|
||||
|
||||
// orteLaden();
|
||||
orteLaden();
|
||||
}
|
||||
|
||||
// //lädt Datei aus rescources ein und speichert Orte in HashSet ab
|
||||
// private void orteLaden() throws FileNotFoundException {
|
||||
//
|
||||
// //UserInterface.class.getClass().getResourceAsStream("resources/PLZ.csv");
|
||||
// Scanner sc = new Scanner(new File("resources/PLZ.csv"));
|
||||
//
|
||||
// int zähler = 0;
|
||||
// while (sc.hasNextLine()) {
|
||||
// String ort = sc.nextLine();
|
||||
//
|
||||
// String[] spalten = ort.split(";");
|
||||
//
|
||||
// orte.add(new Ort(Integer.parseInt(spalten[0]), spalten[1], Double.parseDouble(spalten[2]), Double.parseDouble(spalten[3])));
|
||||
//
|
||||
// zähler++;
|
||||
// }
|
||||
//
|
||||
// System.out.println(zähler + "Orte geladen.");
|
||||
// }
|
||||
//lädt Datei aus rescources ein und speichert Orte in HashSet ab
|
||||
private void orteLaden() throws FileNotFoundException {
|
||||
|
||||
//UserInterface.class.getClass().getResourceAsStream("resources/PLZ.csv");
|
||||
Scanner sc = new Scanner(new File("resources/PLZ.csv"));
|
||||
|
||||
int zähler = 0;
|
||||
while (sc.hasNextLine()) {
|
||||
String ort = sc.nextLine();
|
||||
|
||||
String[] spalten = ort.split(";");
|
||||
|
||||
orte.add(new Ort(Integer.parseInt(spalten[0]), spalten[1], Double.parseDouble(spalten[2]), Double.parseDouble(spalten[3])));
|
||||
|
||||
zähler++;
|
||||
}
|
||||
|
||||
System.out.println(zähler + "Orte geladen.");
|
||||
}
|
||||
|
||||
//gibt Trefferliste passend zum Suchbegriff zurück
|
||||
public String sucheOrt(String suchbegriff) {
|
||||
public Ort[] sucheOrt(String suchbegriff) {
|
||||
Set<Ort> trefferliste = new HashSet<>();
|
||||
String ausgabe = " ";
|
||||
|
||||
//gibt alle Orte zurück
|
||||
if(suchbegriff.equals("alle"))
|
||||
|
@ -57,13 +53,6 @@ public class ReiseFassade {
|
|||
if(o.getName().contains(suchbegriff) && trefferliste.size()<8)
|
||||
trefferliste.add(o);
|
||||
}
|
||||
|
||||
for(Ort o : trefferliste) {
|
||||
ausgabe = ausgabe + o.getName() + " Entfernung: " + new Reiseplanung(user, o).getEntferung() + "\n";
|
||||
}
|
||||
|
||||
return ausgabe;
|
||||
return trefferliste.toArray(new Ort[0]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue