-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathLadderOutputView.java
47 lines (35 loc) · 1.16 KB
/
LadderOutputView.java
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 view;
import dto.LineDto;
public class LadderOutputView {
private static final String INDENTATION = " ";
private static final String DASH_COUPLER = "-----";
private static final String BLANK_COUPLER = " ";
private static final String PILLAR = "|";
private LadderOutputView() {
}
private static final LadderOutputView ladderOutputView = new LadderOutputView();
public static LadderOutputView getInstance() {
return ladderOutputView;
}
public void printResultHeader() {
System.out.println("실행결과");
System.out.println();
}
public void printLine(LineDto lineDto) {
StringBuilder output = new StringBuilder()
.append(INDENTATION)
.append(PILLAR);
for (boolean isExist : lineDto.getLinkExistCollection()) {
String coupler = getCoupler(isExist);
output.append(coupler)
.append(PILLAR);
}
System.out.println(output);
}
private String getCoupler(boolean isLinkExist) {
if (isLinkExist) {
return DASH_COUPLER;
}
return BLANK_COUPLER;
}
}