-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRow.java
More file actions
39 lines (30 loc) · 969 Bytes
/
Row.java
File metadata and controls
39 lines (30 loc) · 969 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.converter;
import domain.ladder.Ladder;
import java.util.List;
import java.util.stream.Collectors;
public class Row implements Comparable<Row> {
private Integer location;
private List<Point> points;
private Row(Integer location, Ladder ladder) {
this.location = location;
this.points = findLocationBridge(ladder);
}
public static Row of(Integer location, Ladder ladder) {
return new Row(location, ladder);
}
private List<Point> findLocationBridge(Ladder ladder) {
return ladder.getPillars().stream()
.map(pillar -> Point.of(pillar.getPillarNum(), pillar.getLevelBridges(location)))
.collect(Collectors.toList());
}
public Integer getLocation() {
return location;
}
public List<Point> getPoints() {
return points;
}
@Override
public int compareTo(Row o) {
return location.compareTo(o.location);
}
}