Repository navigation
Expand file tree
/
Copy pathResultView.java
More file actions
68 lines (55 loc) · 1.93 KB
/
Copy pathResultView.java
File metadata and controls
68 lines (55 loc) · 1.93 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package coordinates.view;
import coordinates.domain.Point;
import java.util.List;
public class ResultView {
private static final String STICK = "|";
private static final String HORIZONTAL = " ̄";
private static final String POINT = "ㆍ";
public static void graphWidthLin(List<Point> points, List<Integer> reversalAxis, List<Integer> axis) {
for (int i = 0; i < 24; i++) {
System.out.print(String.format("%2d", reversalAxis.get(i)));
System.out.print(STICK);
twoLine(points, reversalAxis.get(i), axis);
System.out.println();
}
}
private static void twoLine(List<Point> points, int reversalAxis, List<Integer> axis) {
for (int k = 0; k < 2; k++) {
if (points.get(k).getY() == reversalAxis) {
oneLine(points.get(k), axis);
}
}
}
private static void oneLine(Point points, List<Integer> axis) {
for (int j = 0; j < 24; j++) {
String blankNum = " ";
if (points.getX() == axis.get(j)) {
blankNum = POINT;
}
System.out.print(blankNum);
}
}
public static void graphHeightLine(int axis, boolean blank) {
String input = "";
if (blank == true) {
input = String.valueOf(axis);
System.out.print(HORIZONTAL);
System.out.print(HORIZONTAL);
System.out.print(input);
}
}
public static void height(List<Integer> axiss) {
for (int i = 0; i < axiss.size(); i++) {
int axis = axiss.get(i);
graphHeightLine(axis, blankCondition(axiss.get(i)));
}
System.out.println();
}
public static boolean blankCondition(int axis) {
//1~24까지의 %2는 true
return axis % 2 == 0;
}
public static void mathLine(double line) {
System.out.println("두 점의 길이는 : " + line);
}
}