-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathLottoInputView.java
More file actions
44 lines (34 loc) · 1.78 KB
/
LottoInputView.java
File metadata and controls
44 lines (34 loc) · 1.78 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
package com.nextstep.camp.lotto.view;
import com.nextstep.camp.lotto.domain.vo.LottoAmount;
import com.nextstep.camp.lotto.domain.vo.LottoCount;
import com.nextstep.camp.lotto.view.component.*;
import com.nextstep.camp.lotto.view.dto.LottoInputData;
import com.nextstep.camp.lotto.view.strategy.*;
public class LottoInputView {
private final LottoAmountInput lottoAmountInput;
private final LottoManuelCountInput lottoManuelCountInput;
private final WinningNumbersInput winningNumbersInput;
private LottoTicketsInput lottoTicketsInput;
private LottoInputView() {
LottoAmountInput lottoAmountInput = LottoAmountInput.create(LottoAmountInputStrategy.ofSystemIn());
WinningNumbersInput winningNumbersInput = WinningNumbersInput.create(WinningNumbersInputStrategy.of());
LottoManuelCountInput lottoManuelCountInput = LottoManuelCountInput.create(LottoManuelCountInputStrategy.ofSystemIn());
this.lottoAmountInput = lottoAmountInput;
this.lottoManuelCountInput = lottoManuelCountInput;
this.winningNumbersInput = winningNumbersInput;
}
public static LottoInputView publish() {
return new LottoInputView();
}
public void render() {
LottoAmount lottoAmount = this.lottoAmountInput.action();
LottoCount lottoManuelCount = this.lottoManuelCountInput.action();
LottoTicketsInputStrategy inputStrategy = LottoTicketsInputStrategy.of(lottoAmount, lottoManuelCount);
this.lottoTicketsInput = LottoTicketsInput.create(inputStrategy);
this.lottoTicketsInput.action();
this.winningNumbersInput.action();
}
public LottoInputData toInputData() {
return LottoInputData.of(lottoAmountInput.getValue(), lottoTicketsInput.getValue(), winningNumbersInput.getValue());
}
}