-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathPath.java
More file actions
38 lines (30 loc) · 853 Bytes
/
Copy pathPath.java
File metadata and controls
38 lines (30 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package subway.domain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Path {
private int time;
private int distance;
private List<Station> stations;
public Path(Station departure, int distance, int time) {
this.stations = new ArrayList<Station>();
this.stations.addAll(Arrays.asList(departure));
this.distance = distance;
this.time = time;
}
public Station getStation() {
return stations.get(stations.size()-1);
}
public void addStation(Station nextStation) {
stations.add(nextStation);
}
public void addDistance(int totalDistance) {
distance += totalDistance;
}
public void addTime(int takingTime) {
time += takingTime;
}
public int getDistance() {
return distance;
}
}