de.kosi.model.game
Class AfterGame

java.lang.Object
  |
  +--de.kosi.model.game.AfterGame
All Implemented Interfaces:
GamePhase

public class AfterGame
extends java.lang.Object
implements GamePhase

The base class for results of a game of bridge. This is similarly used as the phase of a game of bridge when it has been finished.

ChangeLog:

 $Log: AfterGame.java,v $
 Revision 1.3  2001/06/01 15:11:14  betacarotine
 readded these two nice files

 Revision 1.3  2001/05/30 10:19:18  pizarro
 Updated Documentation.

 Revision 1.2  2001/05/25 14:51:23  betacarotine
 Added a result handling mechanism for the game.


 

Version:
$Revision: 1.3 $ ($Date: 2001/06/01 15:11:14 $)
Author:
PG KoSI, Fachbereich Informatik, Universitaet Oldenburg

Constructor Summary
AfterGame(Board board)
          Creates a new AfterGame instance with PassedThroughResult.
AfterGame(Board board, java.util.List bids, Contract contract, java.util.List cards, StopWatch stopWatch)
          Creates a new after game instance with TimeExceedResult for the case that the time was exceeded in the playing phase.
AfterGame(Board board, java.util.List bids, StopWatch stopWatch)
          Creates a new AfterGame instance with TimeExceedResult for the case that the time was exceeded in the bidding phase.
AfterGame(Board board, java.util.List bids, SuitContract contract, java.util.List cards, int declarerTricks)
          Creates a new AfterGame instance with NormalResult for the case that the game has been finished normally.
 
Method Summary
 int getActivePlayer()
          Returns the active player.
 java.util.List getCards(int direction)
          The method returns the cards curenty in the hands of the player seated at the given direction.
 Result getResult()
          Returns the result of the game.
 int getState()
          Returns the game state that is represented by this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AfterGame

public AfterGame(Board board)
Creates a new AfterGame instance with PassedThroughResult.
Parameters:
board - The board that was played on.

AfterGame

public AfterGame(Board board,
                 java.util.List bids,
                 Contract contract,
                 java.util.List cards,
                 StopWatch stopWatch)
Creates a new after game instance with TimeExceedResult for the case that the time was exceeded in the playing phase.
Parameters:
board - The board that was played on.
bids - The bids that were made in the bidding phase.
contract - The contract of the game.
cards - The cards that have been played yet.
stopWatch - The stop watch to determine the time exceeding pair.

AfterGame

public AfterGame(Board board,
                 java.util.List bids,
                 StopWatch stopWatch)
Creates a new AfterGame instance with TimeExceedResult for the case that the time was exceeded in the bidding phase.
Parameters:
board - The board that was played on.
bids - The bids that were made in the bidding phase.
stopWatch - The stopWatch to determine the pair that exceeded the time.

AfterGame

public AfterGame(Board board,
                 java.util.List bids,
                 SuitContract contract,
                 java.util.List cards,
                 int declarerTricks)
Creates a new AfterGame instance with NormalResult for the case that the game has been finished normally.
Parameters:
board - The board that was played on.
bids - The bids that were made in the bidding phase.
contract - The contract of the game.
cards - The cards that were played in the playing phase in the order they appeared on the table.
declarerTricks - Number of tricks that the declarer made.
Method Detail

getState

public int getState()
Returns the game state that is represented by this instance.
Specified by:
getState in interface GamePhase
Returns:
The constant Game.FINISHED.

getActivePlayer

public int getActivePlayer()
                    throws InvalidGameStateException
Returns the active player. This method always throws an exception because after a game no player is active.
Specified by:
getActivePlayer in interface GamePhase
Returns:
Nothing, because an exception is thrown.
Throws:
InvalidGameStateException - Is thrown because there is no active player.

getCards

public java.util.List getCards(int direction)
The method returns the cards curenty in the hands of the player seated at the given direction. Because after a game the cards are returned into the board an empty vector is returned. Even if the game could not be finished normally an empty vector is returned. To get the cards that any player initially had use the method Game.getCards(int direction).
Specified by:
getCards in interface GamePhase
Parameters:
direction - The direction the player whose cards are to be returned is seated at.
Returns:
an empty vector.

getResult

public Result getResult()
Returns the result of the game. This is either an instance of NormalResult, of PassedThroughResult or of TimeExceedResult.
Returns:
The result of the game.