supplemented train info with start/stop stations
This commit is contained in:
parent
6d14bc3b9c
commit
fae4b5870e
1 changed files with 10 additions and 1 deletions
|
@ -54,6 +54,14 @@ public class App {
|
||||||
this.arrivalTime = arrivalTime;
|
this.arrivalTime = arrivalTime;
|
||||||
this.stops = stops.clone();
|
this.stops = stops.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Station getStartStation() {
|
||||||
|
return this.stops[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Station getFinalStation() {
|
||||||
|
return this.stops[this.stops.length - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LineData {
|
class LineData {
|
||||||
|
@ -183,7 +191,8 @@ public class App {
|
||||||
String toStationName = sc.nextLine();
|
String toStationName = sc.nextLine();
|
||||||
ArrayList<Train> trains2 = a.trainsFromTo(fromStationName, toStationName);
|
ArrayList<Train> trains2 = a.trainsFromTo(fromStationName, toStationName);
|
||||||
for (Train t : trains2) {
|
for (Train t : trains2) {
|
||||||
System.out.println("found " + t.type.toString());
|
System.out.println("found " + t.type.toString() + " from " + t.getStartStation().getName() + " to "
|
||||||
|
+ t.getFinalStation().getName());
|
||||||
}
|
}
|
||||||
sc.close();
|
sc.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue