@@ -12,12 +12,39 @@ public class OutputView {
12
12
private static final String LADDER_VERTICAL_LINE = "|" ;
13
13
private static final String LADDER_SPACE = " " ;
14
14
private static final String NEWLINE = System .lineSeparator ();
15
+
16
+ private static final String PARTICIPANT_NAME_ALL = "all" ;
15
17
private static final int MAX_NAME_LENGTH = 5 ;
16
18
19
+ private OutputView () {
20
+ }
21
+
17
22
public static void printInputResults (List <LadderResult > inputLadderResults ) {
18
23
System .out .println (formatLadderResults (inputLadderResults ) + NEWLINE );
19
24
}
20
25
26
+ public static void printResultByName (Name inputName , LadderResults ladderResults ) {
27
+ printHeader ();
28
+ if (inputName .getName ().equals (PARTICIPANT_NAME_ALL )) {
29
+ printAllParticipantResults (ladderResults );
30
+ } else {
31
+ printSingleParticipantResult (inputName , ladderResults );
32
+ }
33
+ }
34
+
35
+ private static void printHeader () {
36
+ System .out .println ("실행 결과" );
37
+ }
38
+
39
+ private static void printAllParticipantResults (LadderResults ladderResults ) {
40
+ ladderResults .getAllResults ().forEach ((participant , result ) ->
41
+ System .out .println (participant .getName () + " : " + result .getResult ()));
42
+ }
43
+
44
+ private static void printSingleParticipantResult (Name name , LadderResults ladderResults ) {
45
+ System .out .println (ladderResults .getResultForParticipant (name ).getResult ());
46
+ }
47
+
21
48
public static void printNames (Names names ) {
22
49
String strNames = names .getNames ().stream ()
23
50
.map (name -> String .format (NAME_FORMAT , name .getName ()))
0 commit comments