-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPoint.java
More file actions
47 lines (36 loc) · 1.03 KB
/
Point.java
File metadata and controls
47 lines (36 loc) · 1.03 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
package domain.converter;
import domain.ladder.Bridge;
import java.util.Optional;
public class Point implements Comparable<Point> {
private Integer pillarNum;
private Bridge bridge;
private Point(Integer pillarNum, Bridge bridge) {
this.pillarNum = pillarNum;
this.bridge = bridge;
}
private Point(Integer pillarNum) {
this.pillarNum = pillarNum;
}
public static Point of(Integer pillarNum, Optional<Bridge> bridge) {
if (bridge.isPresent())
return new Point(pillarNum, bridge.get());
return new Point(pillarNum);
}
public boolean isBlankPoint() {
return bridge == null;
}
@Override
public String toString() {
return "pillarNum:" + pillarNum + "/" + "bridge:" + bridge.getLocation();
}
public Integer getPillarNum() {
return pillarNum;
}
public Bridge getBridge() {
return bridge;
}
@Override
public int compareTo(Point o) {
return pillarNum.compareTo(o.pillarNum);
}
}