-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathLines.java
More file actions
39 lines (32 loc) · 813 Bytes
/
Lines.java
File metadata and controls
39 lines (32 loc) · 813 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
39
package domain;
import java.util.ArrayList;
import java.util.List;
public class Lines {
private final List<Line> lines;
public Lines(List<Line> lines) {
this.lines = lines;
}
public List<Line> getLines() {
return lines;
}
public List<String> drawAll() {
List<String> drawn = new ArrayList<>();
for (Line line : lines) {
drawn.add(line.draw());
}
return drawn;
}
public Position moveAll(Position position) {
Position result = position;
for (Line line : lines) {
result = line.move(result);
}
return result;
}
public int getColumnCount() {
if (lines.isEmpty()) {
return 0;
}
return lines.get(0).getBridges().size() + 1;
}
}