@@ -12,12 +12,39 @@ public class OutputView {
1212 private static final String LADDER_VERTICAL_LINE = "|" ;
1313 private static final String LADDER_SPACE = " " ;
1414 private static final String NEWLINE = System .lineSeparator ();
15+
16+ private static final String PARTICIPANT_NAME_ALL = "all" ;
1517 private static final int MAX_NAME_LENGTH = 5 ;
1618
19+ private OutputView () {
20+ }
21+
1722 public static void printInputResults (List <LadderResult > inputLadderResults ) {
1823 System .out .println (formatLadderResults (inputLadderResults ) + NEWLINE );
1924 }
2025
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+
2148 public static void printNames (Names names ) {
2249 String strNames = names .getNames ().stream ()
2350 .map (name -> String .format (NAME_FORMAT , name .getName ()))
0 commit comments