-
Notifications
You must be signed in to change notification settings - Fork 738
/
Copy pathNextStepLines.java
46 lines (35 loc) · 1.12 KB
/
NextStepLines.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
package nextstep.ladder.domain;
import engine.LinesCreator;
import nextstep.ladder.strategy.LineStrategy;
import java.util.ArrayList;
import java.util.List;
public class NextStepLines implements LinesCreator {
private final List<Line> lines;
public NextStepLines() {
this(new ArrayList<Line>());
}
public NextStepLines(ArrayList<Line> lines) {
this.lines = new ArrayList<>(lines);
}
public void generateLine(int participantCnt, int maxLadder, LineStrategy lineStrategy) {
for (int i = 0; i < maxLadder; i++) {
generateLine(participantCnt, lineStrategy);
}
}
private void generateLine(int participantCnt, LineStrategy lineStrategy) {
Line line = new Line(participantCnt, lineStrategy);
lines.add(line);
}
public List<Line> getLines() {
return lines;
}
public int getLineSize(int linesIdx) {
return lines.get(linesIdx).size();
}
public boolean getPoint(int linesIdx, int lineIdx) {
return lines.get(linesIdx).getLine(lineIdx);
}
public int size() {
return lines.size();
}
}