@@ -115,19 +115,15 @@ private String getCommentary(ProcessUnit record) {
115
115
commentary .append (". Attempt is blocked..." );
116
116
switch (statement .getGoalAttemptOutcome ()) {
117
117
case CORNER -> commentary .append ("corner." );
118
- case ATTACK , POSSESSION -> {
119
- commentary .append (teamName );
120
- commentary .append (" on the rebound at pitch position " );
121
- commentary .append (outcomePitchPosition );
122
- attachPitchPositionDescription (outcomePitchPosition , commentary );
123
- }
118
+ case ATTACK , POSSESSION -> appendReboundCommentary (commentary , teamName , outcomePitchPosition );
124
119
case GOALKEEPER -> commentary .append ("goalkeeper has the ball" );
125
120
}
126
121
}
127
122
case SAVE -> {
128
- commentary .append ("...saved by the goalkeeper." );
123
+ commentary .append ("...saved by the goalkeeper. " );
129
124
switch (statement .getGoalAttemptOutcome ()) {
130
125
case CORNER -> commentary .append (" Corner." );
126
+ case ATTACK -> appendReboundCommentary (commentary , teamName , outcomePitchPosition );
131
127
}
132
128
}
133
129
}
@@ -231,6 +227,13 @@ private String getCommentary(ProcessUnit record) {
231
227
return commentary .toString ();
232
228
}
233
229
230
+ private static void appendReboundCommentary (StringBuilder commentary , String teamName , PitchPosition outcomePitchPosition ) {
231
+ commentary .append (teamName );
232
+ commentary .append (" on the rebound at pitch position " );
233
+ commentary .append (outcomePitchPosition );
234
+ attachPitchPositionDescription (outcomePitchPosition , commentary );
235
+ }
236
+
234
237
private static void attachPitchPositionDescription (PitchPosition pitchPosition , StringBuilder commentary ) {
235
238
if (pitchPosition == null ) return ;
236
239
commentary .append (" (" );
0 commit comments