-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathLink.java
More file actions
39 lines (29 loc) · 910 Bytes
/
Link.java
File metadata and controls
39 lines (29 loc) · 910 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 model;
public class Link {
private LinkStatus linkstatus;
private Link(LinkStatus linkstatus) {
this.linkstatus = linkstatus;
}
public static Link getUndefinedLink() {
return new Link(LinkStatus.UNDEFINED);
}
public void setLinkStatus(boolean connectDecider, boolean connectable) {
validateUpdateStatus();
if (connectDecider && connectable) {
this.linkstatus = LinkStatus.PRESENT;
return;
}
this.linkstatus = LinkStatus.ABSENT;
}
public LinkStatus getLinkstatus() {
return linkstatus;
}
private void validateUpdateStatus() {
if (isAlreadyFixed()) {
throw new UnsupportedOperationException("이미 값이 결정된 링크입니다");
}
}
private boolean isAlreadyFixed() {
return this.linkstatus != LinkStatus.UNDEFINED;
}
}