gamekeeper2a
Class BaseballGamekeeper

java.lang.Object
  |
  +--gamekeeper2a.SimpleGamekeeper
        |
        +--gamekeeper2a.BaseballGamekeeper

public class BaseballGamekeeper
extends SimpleGamekeeper

A baseball keeper is aware of the fact that in baseball: 1. A high score wins 2. No ties are possible (keeper's upset over last year's All-Star Game) 3. Scores should be positive


Constructor Summary
BaseballGamekeeper()
          Creates a new instance of BaseballGamekeeper
 
Method Summary
protected  boolean acceptGameResults(IGameResult gresult)
          Private method to check the situation before passing it along to the superclass to accept the result.
 boolean acceptGameResults(java.lang.String gameString)
          Remember the results of a game The contestant with the LARGER score is the winner.
 boolean acceptGameResults(java.lang.String contestant1, int contestant1Score, java.lang.String contestant2, int contestant2Score)
          Remember the results of a match.
static void main(java.lang.String[] args)
          Purely for testing.
 
Methods inherited from class gamekeeper2a.SimpleGamekeeper
acceptGameResults, acceptGameResults, findContestant, listContestantResults, listContestants, setGameResults, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseballGamekeeper

public BaseballGamekeeper()
Creates a new instance of BaseballGamekeeper

Method Detail

acceptGameResults

public boolean acceptGameResults(java.lang.String gameString)
Remember the results of a game The contestant with the LARGER score is the winner. Ties are not allowed. Negative scores are not allowed. String must be non-null. 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).

Specified by:
acceptGameResults in class SimpleGamekeeper
Returns:
true if the results are all valid; false otherwise.

acceptGameResults

public boolean acceptGameResults(java.lang.String contestant1,
                                 int contestant1Score,
                                 java.lang.String contestant2,
                                 int contestant2Score)
Remember the results of a match. The contestant with the LARGER score is the winner. Ties are not permitted. Negative scores are not allowed. Strings must be non-null. 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).

Specified by:
acceptGameResults in class SimpleGamekeeper
Returns:
true if the results are all valid; false otherwise.

acceptGameResults

protected boolean acceptGameResults(IGameResult gresult)
Private method to check the situation before passing it along to the superclass to accept the result.

Overrides:
acceptGameResults in class SimpleGamekeeper
Returns:
true if all is OK, false otherwise.

main

public static void main(java.lang.String[] args)
Purely for testing.

Parameters:
args - the command line arguments