/** * @author Justin Hogg * @date 21/11/2006 * @version 0.1 * * This class outlines the comment (superclass) structure * */ public class Comment { private String type; // type of comment - goal, kick, ... private String partOne; // Holds first speech part of comment (all comments have at least one part) private String partTwo; // Second part (if applicable) private String partThree; // Third part (if applicable) private String partFour; // Fourth part (if applicable) private int importanceRating; // distinguishes comments from each other private boolean used; // flag to indicate comment has been spoken // Constructor public Comment(String type, String partOne, int importanceRating, boolean used) { this.type = type; this.partOne = partOne; this.importanceRating = importanceRating; this.used = false; } // Constructor 2 String parts public Comment(String type, String partOne, String partTwo, int importanceRating, boolean used) { this.type = type; this.partOne = partOne; this.partTwo = partTwo; this.importanceRating = importanceRating; this.used = false; } // Constructor 3 String parts public Comment(String type, String partOne, String partTwo, String partThree, int importanceRating, boolean used) { this.type = type; this.partOne = partOne; this.partTwo = partTwo; this.partThree = partThree; this.importanceRating = importanceRating; this.used = false; } // Constructor 4 String parts public Comment(String type, String partOne, String partTwo, String partThree, String partFour, int importanceRating, boolean used) { this.type = type; this.partOne = partOne; this.partTwo = partTwo; this.partThree = partThree; this.partFour = partFour; this.importanceRating = importanceRating; this.used = false; } /** * Method to return the type part of the comment * (defines the type of comment - GOAL, MISS, ...) */ public String getType() { return type; } /** * Method to return the first text part of the comment * i.e. the first string of the text to be spoken */ public String getPartOne() { return partOne; } /** * Method to set the first text part of the comment * i.e. the first string of the text to be spoken * used to produce a comment for potential output * * This method is used to concatanate comment parts * & variables (player numbers, team names, ...) * into a single string stored in String partOne of * a comment object ready for passing to the Output * object for speech * * @param markedUpComment String to set partOne of comment object to */ public void setPartOne(String markedUpComment) { partOne = markedUpComment; } /** * Method to return the second text part of the comment * i.e. the second string of the text to be spoken */ public String getPartTwo() { return partTwo; } /** * Method to return the third text part of the comment * i.e. the third string of the text to be spoken */ public String getPartThree() { return partThree; } /** * Method to return the fourth text part of the comment * i.e. the fourth string of the text to be spoken */ public String getPartFour() { return partFour; } /** * Method to return the importance rating part of the comment */ public int getImportance() { return importanceRating; } /** * Method to set the used field of a comment to true */ public void setUsed() { used = true; } /** * Method to reset the used field of a comment to false */ public void unSetUsed() { used = false; } }