/* * IRecordkeeper.java * * Created on June 19, 2003, 6:4 */ package gamekeeper2a; /** A gamekeeper keeps track of matches which have been recorded, * and reports on status as requested. * Each match has two contestants. * */ public interface IRecordkeeper { /** Remember the results of a match. * The order of the contestants does not imply anything. * White space at the begining and ending of the winner or loser should be ignored. * For example, "Tyler", " Tyler", and " Tyler " * should all be considered the same contestant. * The two contestants must not be the same (after trimming spaces). * @return true if there were no errors detected and the information has * been recorded; false if there were errors (in which case the information * is not remembered.) */ public boolean acceptGameResults(String contestant1, int contestant1Score, String contestant2, int contestant2Score); /** Remember the results of a match. * Information about the match is in a string with the following format: * , * The comma is required, and must immediately follow the first score (no intervening spaces). * Examples, all legal: * "Mariners 8, Orioles 0" * " WSU 0, UW 108 " * Examples, illegal: * "Mariners 8 Orioles 0" * "Mariners 8, Orioles" * White space at the begining and ending of the winner or loser should be ignored. * For example, "Tyler", " Tyler", and " Tyler " * should all be considered the same contestant. * The two contestants must not be the same (after trimming spaces). * @return true if there were no errors detected and the information has * been recorded; false if there were errors (in which case the information * is not remembered.) */ public boolean acceptGameResults(String gameInfoString); /** Given a contestant name, find the information about it. * @param contestantName the name to search for; surrounding spaces are ignored. * @return the information for the team with this name, if it is known, * null if the team is not known. */ public IContestant findContestant(String contestantName); /** Return a list with exactly one entry for each known contestant. * The elements of the list are of type IContestant. */ public java.util.ArrayList listContestants(); /** Returns a string array giving information about all known contestants, * in no particular order. * The array has exactly one line (string) per contestant, with the * contestant name at the beginning of the line, a space, followed by the * number of games won, a dash, then the number of games lost. * The line should be suitable for displaying on a console without * any changes. */ public String[] listContestantResults(); }