import java.util.ArrayList; import java.util.Collections; /** * @author Justin Hogg * @date 16/11/2006 * * This class houses the templates for each * game action type e.g. goal, pass, etc. * It also tracks how recently each comment has been used. * */ public class CommentTemplateStore { private ArrayList winsPossessionComments; private ArrayList freeKickComments; private ArrayList keepingPossessionComments; private ArrayList touchedGoalComments; private ArrayList untouchedGoalComments; private ArrayList pressureDefenceComments; private ArrayList missedShotComments; private ArrayList gameStartComments; private ArrayList gameDrawComments; private ArrayList gameWinComments; private ArrayList passComments; private ArrayList possessionLostComments; private ArrayList counterAttackComments; private ArrayList openGoalComments; private ArrayList crossChanceComments; private ArrayList pastLastDefenderComments; // Hardcoded string comments (no variance) private static final String HALF_FIRST_HALF = "Half way through the first half"; private static final String ALMOST_HALF_TIME = "First half nearly over"; private static final String HALF_TIME = "Half Time, players look tired after a great display of football, join us after the break"; private static final String HALF_SECOND_HALF = "Half way through the second half"; private static final String ALMOST_OVER = "The game is almost over"; private static final String VO_KEEPER = "Off the keeper for the corner"; private static final String VO_DEFENDER = "Deflected by the defender, corner kick"; private static final String HORIZONTAL_OUT = "Kick in"; private static final String OFFSIDE = "He has wandered offside"; private static final String DRIBBLING = " dribbles"; private static final String ONE_TWO = "One two between "; private static final String AND = " and "; private static final String MATCH_START_ONE = "Match is about to start. "; private static final String MATCH_START_TWO = " on the left and "; private static final String MATCH_START_THREE = " on the right. "; private static final String MATCH_DRAW = "Match ends in a draw, neither side looked like winning it. "; private static final String WIN_PART_ONE = "Great win for "; private static final String WIN_PART_TWO = " winning by "; private static final String WIN_PART_THREE = " goals. "; private static final String MAN_OF_MATCH = " is man of the match"; private static final String SHOT_ONE = " shoots from "; private static final String SHOT_TWO = " yards"; private static final String BAD_GOAL_KICK = "Goalie gives the ball to the other team"; private static final String PASS_PART_TWO = ". That was a long Pass"; // Non variable Comment objects - using single hardcoded Strings private Comment hfh, aht, ht, hsh, ao; // time period comments private Comment voKeeper, voDefender; // vertical out comments private Comment horizontalOut; // as names ... private Comment offside; private Comment dribbling; private Comment oneTwo; private Comment matchStart; private Comment matchDraw; private Comment matchWin; private Comment shot; private Comment badGoalKick; private int wpcCounter = 0; // monitors last spoken wins possession comment index private int fkcCounter = 0; // monitors last spoken free kick comment index private int kpcCounter = 0; // monitors last spoken keeping possesion comment index private int tgcCounter = 0; // monitors last spoken touched goal comment index private int ugcCounter = 0; // monitors last spoken untouched goal comment index private int dpcCounter = 0; // ... for defence pressure comments private int mscCounter = 0; // ... for missed shot comments private int pcCounter = 0; // as above for pass comments private int plcCounter = 0; // ... for possession lost comments private int cacCounter = 0; // ... for counter attack comments private int ogcCounter = 0; // ... for open goal comments private int cccCounter = 0; // ... cross chance comments private int pldcCounter = 0; // past last defender comments //Constructor public CommentTemplateStore() { // initialize rotational comment structures winsPossessionComments = new ArrayList(); initializeWinsPossessionComments(); freeKickComments = new ArrayList(); initializeFreeKickComments(); keepingPossessionComments = new ArrayList(); initializeKeepingPossessionComments(); touchedGoalComments = new ArrayList(); initializeTouchedGoalComments(); untouchedGoalComments = new ArrayList(); initializeUntouchedGoalComments(); missedShotComments = new ArrayList(); initializeMissedShotComments(); passComments = new ArrayList(); initializePassComments(); possessionLostComments = new ArrayList(); initializePossessionLostComments(); counterAttackComments = new ArrayList(); initializeCounterAttackComments(); openGoalComments = new ArrayList(); initializeOpenGoalComments(); crossChanceComments = new ArrayList(); initializeCrossChanceComments(); pastLastDefenderComments = new ArrayList(); initializePastLastDefenderComments(); pressureDefenceComments = new ArrayList(); initializePressureDefenceComments(); // initialize static comments initializeTimeComments(); initializeVOComments(); initializeHOComments(); initializeOffsideComments(); initializeDribblingComments(); initializeOneTwoComments(); initializeMatchStartComments(); initializeMatchDrawComments(); initializeMatchWinComments(); initializeShotComments(); initializeBadGoalKickComments(); } // initializes time comments private void initializeTimeComments() { hfh = new Comment("TIME", HALF_FIRST_HALF, 7, false); aht = new Comment("TIME", ALMOST_HALF_TIME, 7, false); ht = new Comment("TIME", HALF_TIME, 7, false); hsh = new Comment("TIME", HALF_SECOND_HALF, 7, false); ao = new Comment("TIME", ALMOST_OVER, 7, false); } /* * Method to return time comments * * @param id int order of occurance * @returns Comment based on id 1-5 inclusive, null otherwise */ public Comment getTimeComment(int id) { switch (id) { case 1: return hfh; // no break - return ends case case 2: return aht; case 3: return ht; case 4: return hsh; case 5: return ao; default: return null; } } // initializes vertical out comments private void initializeVOComments() { voKeeper = new Comment("VOUT", VO_KEEPER, 10, false); voDefender = new Comment("VOUT", VO_DEFENDER, 10, false); } /* * Method to return vertical out comments * * @param keeper boolean vertical out from keeper if true, off defender if false * @returns Comment describing vertical out */ public Comment getVOComment(boolean keeper) { if (keeper) return voKeeper; else return voDefender; } // initializes horizontal out comment private void initializeHOComments() { horizontalOut = new Comment("HOUT", HORIZONTAL_OUT, 11, false); } /* * Method to return horizontal out comment * * @returns Comment describing horizontal out */ public Comment getHOComment() { return horizontalOut; } // initializes offside comment private void initializeOffsideComments() { offside = new Comment("OFFS", OFFSIDE, 9, false); } /* * Method to return offside comment * * @returns Comment describing offside */ public Comment getOffsideComment() { return offside; } // initializes dribbling comment private void initializeDribblingComments() { dribbling = new Comment("DRIB", DRIBBLING, 12, false); } /* * Method to return dribbling comment * * @returns Comment describing dribbling */ public Comment getDribblingComment() { return dribbling; } // initializes one two comment private void initializeOneTwoComments() { oneTwo = new Comment("ONTW", ONE_TWO, AND, 12, false); } /* * Method to return one two comment * * @returns Comment describing one two */ public Comment getOneTwoComment() { return oneTwo; } // initializes match start comment private void initializeMatchStartComments() { matchStart = new Comment("STAR", MATCH_START_ONE, MATCH_START_TWO, MATCH_START_THREE, 6, false); } /* * Method to return match start comment * * @returns Comment describing match starting */ public Comment getMatchStartComment() { return matchStart; } // initializes match draw comment private void initializeMatchDrawComments() { matchDraw = new Comment("DRAW", MATCH_DRAW, MAN_OF_MATCH, 5, false); } /* * Method to return match draw comment * * @returns Comment describing match that ends in a draw */ public Comment getMatchDrawComment() { return matchDraw; } // initializes match win comment private void initializeMatchWinComments() { matchWin = new Comment("MWIN", WIN_PART_ONE, WIN_PART_TWO, WIN_PART_THREE, MAN_OF_MATCH, 4, false); } /* * Method to return match win comment * * @returns Comment describing match that ends with a team winning */ public Comment getMatchWinComment() { return matchWin; } // initializes shot comment private void initializeShotComments() { shot = new Comment("SHOT", SHOT_ONE, SHOT_TWO, 2, false); } /* * Method to return shot comment * * @returns Comment describing shot */ public Comment getShotComment() { return shot; } // initializes bad goal kick comment private void initializeBadGoalKickComments() { badGoalKick = new Comment("BGKI", BAD_GOAL_KICK, 12, false); } /* * Method to return bad goal kick comment * * @returns Comment describing bad goal kick */ public Comment getBadGoalKickComment() { return badGoalKick; } /** * Method that populates wins possession comments ArrayList */ private void initializeWinsPossessionComments() { // First create comments Comment wpcOne = new Comment ("WIN", " wins it back", 12, false ); Comment wpcTwo = new Comment ("WINP", " recovers the ball", 12, false); Comment wpcThree = new Comment ("WINP", " steals it back", 12, false); Comment wpcFour = new Comment ("WINP", " gets the ball from opposition", 12, false); Comment wpcFive = new Comment ("WINP", " regains it from the other team", 12, false); // Then add winsPossessionComments.add(wpcOne); winsPossessionComments.add(wpcTwo); winsPossessionComments.add(wpcThree); winsPossessionComments.add(wpcFour); winsPossessionComments.add(wpcFive); // and shuffle so comments not always in same order Collections.shuffle(winsPossessionComments); } /* * Method to return wins possession comment * * @returns Comment describing player winning (back) ball possession */ public Comment getWinsPossessionComment() { // check if all spoken, if so reset if(wpcCounter == winsPossessionComments.size() ) { wpcCounter = 0; } Comment winsPossessionComment = winsPossessionComments.get(wpcCounter); wpcCounter++; return winsPossessionComment; } /** * Method that populates free kick comments ArrayList */ private void initializeFreeKickComments() { // First create comments Comment fkcOne = new Comment ("FREE", "Free kick awarded to the ", 8, false); Comment fkcTwo = new Comment ("FREE", "Over to the ", 8, false); Comment fkcThree = new Comment ("FREE", "Free kick goes to the ", 8, false); Comment fkcFour = new Comment ("FREE", "What will we see here from the ", 8, false); Comment fkcFive = new Comment ("FREE", "Free kick and a chance for the ", 8, false); Comment fkcSix = new Comment ("FREE", "Can this be turned into something by the ", 8, false); // Then add freeKickComments.add(fkcOne); freeKickComments.add(fkcTwo); freeKickComments.add(fkcThree); freeKickComments.add(fkcFour); freeKickComments.add(fkcFive); freeKickComments.add(fkcSix); } /** * Method to return freekick comment * * @returns Comment describing freekick */ public Comment getFreeKickComment() { // check if all spoken, if so reset if(fkcCounter == freeKickComments.size() ) { fkcCounter = 0; } Comment freeKickComment = freeKickComments.get(fkcCounter); fkcCounter++; return freeKickComment; } /** * Method that populates keeping possession comments ArrayList **/ private void initializeKeepingPossessionComments() { // First create comments Comment kpcOne = new Comment ("KEEP", " keeping the ball well", 12, false ); Comment kpcTwo = new Comment ("KEEP", " holding well", 12, false); Comment kpcThree = new Comment ("KEEP", " holding possession", 12, false); Comment kpcFour = new Comment ("KEEP", " controlling the field", 12, false); Comment kpcFive = new Comment ("KEEP", " keeping the advantage", 12, false); // Then add keepingPossessionComments.add(kpcOne); keepingPossessionComments.add(kpcTwo); keepingPossessionComments.add(kpcThree); keepingPossessionComments.add(kpcFour); keepingPossessionComments.add(kpcFive); // and shuffle so comments not always in same order Collections.shuffle(keepingPossessionComments); } /** * Method to return keeping possession comment * * @returns Comment describing team keeping ball possession */ public Comment getKeepingPossessionComment() { // check if all spoken, if so reset & shuffle order if(kpcCounter == keepingPossessionComments.size() ) { kpcCounter = 0; Collections.shuffle(keepingPossessionComments); } Comment keepingPossessionComment = keepingPossessionComments.get(kpcCounter); kpcCounter++; return keepingPossessionComment; } /** * Method that populates touched goal comments ArrayList * i.e. 'touched goal' - goalie got a hand to the ball, but didn't save it * */ private void initializeTouchedGoalComments() { // First create comments Comment tgcOne = new Comment ("GOAL", " Gooooaaaal ", " from ", " yards. The Keeper Got A Hand To It But Couldn't Hold On To It", 1, false ); Comment tgcTwo = new Comment ("GOAL", " Gooooaaaal ", " scored from ", " . The keeper had a chance but made bad use of it", 1, false); Comment tgcThree = new Comment ("GOAL", " Gooooaaaal ", " from ", ". Almost saved by the keeper", 1, false); Comment tgcFour = new Comment ("GOAL", " Gooooaaaal ", " with a shot from ", " . The keeper got a hand to the ball", 1, false); Comment tgcFive = new Comment ("GOAL", " Gooooaaaal ", " from a distance of ", " out. Slipped through the keepers fingers", 1, false); // Then add touchedGoalComments.add(tgcOne); touchedGoalComments.add(tgcTwo); touchedGoalComments.add(tgcThree); touchedGoalComments.add(tgcFour); touchedGoalComments.add(tgcFive); // and shuffle so comments not always in same order Collections.shuffle(touchedGoalComments); } /** * Method to retrieve touched goal comment * @return touchedGoalComment randomly selected comment from touchedGoalComments arraylist * */ public Comment getTouchedGoalComment() { // check if all spoken, if so reset & shuffle order if(tgcCounter == touchedGoalComments.size() ) { tgcCounter = 0; Collections.shuffle(touchedGoalComments); } Comment touchedGoalComment = touchedGoalComments.get(tgcCounter); tgcCounter++; return touchedGoalComment; } /** * Method that populates untouched goal comments ArrayList * */ private void initializeUntouchedGoalComments() { // First create comments Comment ugcOne = new Comment ("GOAL", " Gooooaaaal ", " from ", " yards. Straight past the keeper", 1, false ); Comment ugcTwo = new Comment ("GOAL", " Gooooaaaal ", " scored from ", "yards. Goalie could not get a hand to it", 1, false); Comment ugcThree = new Comment ("GOAL", " Gooooaaaal ", " from ", "yards. Untouched by the keeper", 1, false); Comment ugcFour = new Comment ("GOAL", " Gooooaaaal ", " with a shot from ", " . yards. Goalkeeper didn't make contact", 1, false); Comment ugcFive = new Comment ("GOAL", " Gooooaaaal ", " from a distance of ", " yards out. Goalie could not reach it", 1, false); // Then add untouchedGoalComments.add(ugcOne); untouchedGoalComments.add(ugcTwo); untouchedGoalComments.add(ugcThree); untouchedGoalComments.add(ugcFour); untouchedGoalComments.add(ugcFive); // and shuffle so comments not always in same order Collections.shuffle(untouchedGoalComments); } /** * Method to retrieve untouched goal comment * @return untouchedGoalComment randomly selected comment from untouchedGoalComments arraylist * */ public Comment getUntouchedGoalComment() { // check if all spoken, if so reset & shuffle order if(ugcCounter == untouchedGoalComments.size() ) { ugcCounter = 0; Collections.shuffle(untouchedGoalComments); } Comment untouchedGoalComment = untouchedGoalComments.get(ugcCounter); ugcCounter++; return untouchedGoalComment; } // initializes pressure on the defence comment arraylist private void initializePressureDefenceComments() { //first create comments Comment dpcOne = new Comment ("PRES", "Pressure on the defence", 12, false); Comment dpcTwo = new Comment ("PRES", "Increased Pressure on the defenders", 12, false); Comment dpcThree = new Comment ("PRES", "The defenders are under pressure", 12, false); Comment dpcFour = new Comment ("PRES", "Things are heating up for the defence", 12, false); Comment dpcFive = new Comment ("PRES", "Defence is under attack", 12, false); Comment dpcSix = new Comment ("PRES", "Time For defence to wake up", 12, false); Comment dpcSeven = new Comment ("PRES", "Defence must step up", 12, false); // then add to arrayList for defence pressure pressureDefenceComments.add(dpcOne); pressureDefenceComments.add(dpcTwo); pressureDefenceComments.add(dpcThree); pressureDefenceComments.add(dpcFour); pressureDefenceComments.add(dpcFive); pressureDefenceComments.add(dpcSix); pressureDefenceComments.add(dpcSeven); // and shuffle so comments not always in same order Collections.shuffle(pressureDefenceComments); } /* * Method to return pressure on defence comment * * @returns Comment describing pressure on defence */ public Comment getPressureDefenceComment() { // check if all spoken, if so reset & shuffle order if(dpcCounter == pressureDefenceComments.size() ) { dpcCounter = 0; Collections.shuffle(pressureDefenceComments); } Comment pressureDefenceComment = pressureDefenceComments.get(dpcCounter); dpcCounter++; return pressureDefenceComment; } /** * Method that populates missed shot comments ArrayList * */ private void initializeMissedShotComments() { // create comments Comment mscOne = new Comment ("MISS", "Just wide by ", " yards, Bad luck ", 3, false ); Comment mscTwo = new Comment ("MISS", "Shot missed by ", " yards, not on target. Good try from ", 3, false ); Comment mscThree = new Comment ("MISS", "Shot off-target by ", " yards, Get some glasses for ", 3, false ); Comment mscFour = new Comment ("MISS", "Shot wide by ", " yards, The fans will be disappointed with ", 3, false ); Comment mscFive = new Comment ("MISS", "A missed shot ", " yards outside post, Teammates will not be pleased with ", 3, false ); // then add to arrayList for missed shot comments missedShotComments.add(mscOne); missedShotComments.add(mscTwo); missedShotComments.add(mscThree); missedShotComments.add(mscFour); missedShotComments.add(mscFive); // and shuffle so comments not always in same order Collections.shuffle(missedShotComments); } /** * Method to retrieve a missed shot comment * @return missedShotComment randomly selected comment from missedShotComments arraylist * */ public Comment getMissedShotComment() { // check if all spoken, if so reset & shuffle order if(mscCounter == missedShotComments.size() ) { mscCounter = 0; Collections.shuffle(missedShotComments); } Comment missedShotComment = missedShotComments.get(mscCounter); mscCounter++; return missedShotComment; } /** * Method that populates game start comments ArrayList * */ private void initializeGameStartComments() { } /** * Method that populates game draw comments ArrayList * */ private void initializeGameDrawComments() { // TODO - can be developed for further variation } /** * Method that populates game win comments ArrayList * */ private void initializeGameWinComments() { // TODO - can be developed for further variation } /** * Method that populates pass comments ArrayList * */ private void initializePassComments() { // First create comments Comment pcOne = new Comment ("PASS", ", received from ", PASS_PART_TWO, 12, false ); Comment pcTwo = new Comment ("PASS", ", delivered by ", PASS_PART_TWO, 12, false); Comment pcThree = new Comment ("PASS", " 's possession, sent by ", PASS_PART_TWO, 12, false); Comment pcFour = new Comment ("PASS", "'s ball, forwarded from ", PASS_PART_TWO, 12, false); Comment pcFive = new Comment ("PASS", ". Passed from ", PASS_PART_TWO, 12, false); Comment pcSix = new Comment ("PASS", ". collects from ", PASS_PART_TWO, 12, false); // Then add passComments.add(pcOne); passComments.add(pcTwo); passComments.add(pcThree); passComments.add(pcFour); passComments.add(pcFive); passComments.add(pcSix); // and shuffle so comments not always in same order Collections.shuffle(passComments); } /** * Method to retrieve pass comment * @return passComment randomly selected comment from passComments arraylist * */ public Comment getPassComment() { // check if all spoken, if so reset & shuffle order if(pcCounter == passComments.size() ) { pcCounter = 0; Collections.shuffle(passComments); } Comment passComment = passComments.get(pcCounter); pcCounter++; return passComment; } /** * Method that populates possession lost comments ArrayList * */ private void initializePossessionLostComments() { // First create comments Comment plcOne = new Comment ("PLOS", " looses possession", 12, false ); Comment plcTwo = new Comment ("PLOS", " looses it", 12, false); Comment plcThree = new Comment ("PLOS", " gives it away", 12, false); Comment plcFour = new Comment ("PLOS", " couldn't hold on to it", 12, false); Comment plcFive = new Comment ("PLOS", " gives possession away", 12, false); // Then add possessionLostComments.add(plcOne); possessionLostComments.add(plcTwo); possessionLostComments.add(plcThree); possessionLostComments.add(plcFour); possessionLostComments.add(plcFive); // and shuffle so comments not always in same order Collections.shuffle(possessionLostComments); } /** * Method to retrieve possession lost comment * @return possessionLostComment randomly selected comment from possessionLostComments arraylist * */ public Comment getPossessionLostComment() { // check if all spoken, if so reset & shuffle order if(plcCounter == possessionLostComments.size() ) { plcCounter = 0; Collections.shuffle(possessionLostComments); } Comment possessionLostComment = possessionLostComments.get(plcCounter); plcCounter++; return possessionLostComment; } /** * Method that populates counter attack comments ArrayList * */ private void initializeCounterAttackComments() { // First create comments Comment cacOne = new Comment ("COUN", " in a strong position for a goal attack", 12, false ); Comment cacTwo = new Comment ("COUN", " have a goal chance", 12, false); Comment cacThree = new Comment ("COUN", " looking strong on goal", 12, false); Comment cacFour = new Comment ("COUN", " outnumbering the defence", 12, false); Comment cacFive = new Comment ("COUN", " may steal a goal now", 12, false); // Then add counterAttackComments.add(cacOne); counterAttackComments.add(cacTwo); counterAttackComments.add(cacThree); counterAttackComments.add(cacFour); counterAttackComments.add(cacFive); // and shuffle so comments not always in same order Collections.shuffle(counterAttackComments); } /** * Method to retrieve counterattack comment * @return counterAttackComment randomly selected comment from counterAttackComments arraylist * */ public Comment getCounterAttackComment() { // check if all spoken, if so reset & shuffle order if(cacCounter == counterAttackComments.size() ) { cacCounter = 0; Collections.shuffle(counterAttackComments); } Comment counterAttackComment = counterAttackComments.get(cacCounter); cacCounter++; return counterAttackComment; } /** * Method that populates open goal comments ArrayList * */ private void initializeOpenGoalComments() { // First create comments Comment ogcOne = new Comment ("OPEN", "Goal is wide open" , 12, false ); Comment ogcTwo = new Comment ("OPEN", "Open goal", 12, false); Comment ogcThree = new Comment ("OPEN", "No keeper! Great opportunity", 12, false); Comment ogcFour = new Comment ("OPEN", " Open goal, great chance here", 12, false); Comment ogcFive = new Comment ("OPEN", "Clear shot available", 12, false); // Then add openGoalComments.add(ogcOne); openGoalComments.add(ogcTwo); openGoalComments.add(ogcThree); openGoalComments.add(ogcFour); openGoalComments.add(ogcFive); // and shuffle so comments not always in same order Collections.shuffle(openGoalComments); } /** * Method to retrieve an open goal comment * @return openGoalComment randomly selected comment from openGoalComments arraylist * */ public Comment getOpenGoalComment() { // check if all spoken, if so reset & shuffle order if(ogcCounter == openGoalComments.size() ) { ogcCounter = 0; Collections.shuffle(openGoalComments); } Comment openGoalComment = openGoalComments.get(ogcCounter); ogcCounter++; return openGoalComment; } /** * Method that populates cross chance comments ArrayList * */ private void initializeCrossChanceComments() { // First create comments Comment cccOne = new Comment ("CROS", " can cross for a goal chance" , 12, false ); Comment cccTwo = new Comment ("CROS", " should cross for the shot", 12, false); Comment cccThree = new Comment ("CROS", " could cross for an attempt on goal", 12, false); //Comment cccFour = new Comment //("CROS", " should cross to shoot ", 12, false); Comment cccFive = new Comment ("CROS", " might cross it in for a chance", 12, false); // Then add crossChanceComments.add(cccOne); crossChanceComments.add(cccTwo); crossChanceComments.add(cccThree); //crossChanceComments.add(cccFour); crossChanceComments.add(cccFive); // and shuffle so comments not always in same order Collections.shuffle(crossChanceComments); } /** * Method to retrieve a cross chance comment * @return crossChanceComment randomly selected comment from crossChanceComments arraylist * */ public Comment getCrossChanceComment() { // check if all spoken, if so reset & shuffle order if(cccCounter == crossChanceComments.size() ) { cccCounter = 0; Collections.shuffle(crossChanceComments); } Comment crossChanceComment = crossChanceComments.get(cccCounter); cccCounter++; return crossChanceComment; } /** * Method that populates past last defender comments ArrayList * */ private void initializePastLastDefenderComments() { // First create comments Comment pldcOne = new Comment ("PAST", "It's just the keeper and " , 12, false ); Comment pldcTwo = new Comment ("PAST", "Only the goalie stopping ", 12, false); Comment pldcThree = new Comment ("PAST", "One against one. Goalie and ", 12, false); Comment pldcFour = new Comment ("PAST", "Only the keeper between goal and ", 12, false); Comment pldcFive = new Comment ("PAST", "Just the keeper to block ", 12, false); // Then add pastLastDefenderComments.add(pldcOne); pastLastDefenderComments.add(pldcTwo); pastLastDefenderComments.add(pldcThree); pastLastDefenderComments.add(pldcFour); pastLastDefenderComments.add(pldcFive); // and shuffle so comments not always in same order Collections.shuffle(pastLastDefenderComments); } /** * Method to retrieve a past last defender comment * @return pastLastDefenderComment randomly selected comment from pastLastDefenderComments arraylist * */ public Comment getPastLastDefenderComment() { // check if all spoken, if so reset & shuffle order if(pldcCounter == pastLastDefenderComments.size() ) { pldcCounter = 0; Collections.shuffle(pastLastDefenderComments); } Comment pastLastDefenderComment = pastLastDefenderComments.get(pldcCounter); pldcCounter++; return pastLastDefenderComment; } }