-
Notifications
You must be signed in to change notification settings - Fork 273
Expand file tree
/
Copy pathLine.java
More file actions
55 lines (43 loc) · 1.31 KB
/
Copy pathLine.java
File metadata and controls
55 lines (43 loc) · 1.31 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package subway.line;
import subway.line.validation.CheckLineNameDuplicate;
import subway.line.validation.CheckLineNameLength;
import subway.station.Station;
public class Line {
private String name;
private EachLineStations stations;
public Line(String name) {
validLineName(name);
this.name = name;
this.stations = new EachLineStations();
}
public Line(String name, EachLineStations stations) {
validLineName(name);
this.name = name;
this.stations = stations;
}
public String getName() {
return name;
}
public EachLineStations getStations() {
return stations;
}
public void addStation(Station station) {
stations.addStation(station);
}
private void validLineName(String name) {
CheckLineNameLength.validation(name);
CheckLineNameDuplicate.validation(name);
}
public boolean isRegistered(String name) {
return stations.isRegistered(name);
}
public void addSection(Station station, int sectionNumber) {
stations.addSection(station, sectionNumber);
}
public boolean isNotExistSection(int number) {
return stations.isNotExistSection(number);
}
public void deleteSection(Station station) {
stations.deleteStation(station);
}
}