de.kosi.model.tournament
Class Match

java.lang.Object
  |
  +--de.kosi.model.tournament.Match
All Implemented Interfaces:
GameContainer

public class Match
extends java.lang.Object
implements GameContainer

This class represents a pairing of two pairs and the boards to be played by them. In each round of a Bridge tournament this class is needed for every table.

ChangeLog:

 $Log: Match.java,v $
 Revision 1.3  2001/07/31 12:55:27  betacarotine
 worked on the tournament

 Revision 1.2  2001/07/31 12:15:24  betacarotine
 worked on the tournament

 Revision 1.1.1.1  2001/04/29 18:05:18  jiriki
 Imported sources from zola.

 Revision 1.4  2001/04/25 12:47:06  login
 Implemented stopwatch

 Revision 1.3  2001/04/25 12:05:40  login
 Worked on TournamentImpl

 Revision 1.2  2001/04/20 15:10:14  login
 updated docs

 Revision 1.1  2001/03/15 20:14:32  login
 Renamed the class Round to Match

 Revision 1.2  2001/03/06 15:58:45  login
 updated documentation


 

Version:
$Revision: 1.3 $ ($Date: 2001/07/31 12:55:27 $)
Author:
Timo, Niklas, Ole

Constructor Summary
Match(Board[] boardSet, Pair northSouth, Pair eastWest)
          Creates a new instance of this class.
 
Method Summary
 void appealToJudge(java.lang.String reason)
          Appeal to a judge.
 void gameFinished(Result result)
          Called by the game when it has just been finished.
 Board getBoard(int index)
          Returns the board that is stored at the given index.
 Pair getEastWest()
          Returns the pair that is seated east-west.
 Pair getNorthSouth()
          Returns the pair that is seated north-south.
 int getNumberOfBoards()
          Returns the number of boards that are to be played by the two pairs.
 void setCallback(MatchCallback callback)
          Set a callback function that will be called when the match finishes.
 void start(TournamentImpl tournament)
          Start the match.
 void terminate()
          Terminate the match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Match

public Match(Board[] boardSet,
             Pair northSouth,
             Pair eastWest)
Creates a new instance of this class.
Parameters:
boardSet - The set of boards to be played on by the pairs. May not be null and should at least contain one Board instance.
northSouth - The pair seated north-south. May not be null.
eastWest - The pair seated east-west. May not be null.
Method Detail

start

public void start(TournamentImpl tournament)
Start the match.
Parameters:
tournament - Tournament this match belongs to.

terminate

public void terminate()
Terminate the match. May also be called on an already finished match.

setCallback

public void setCallback(MatchCallback callback)
Set a callback function that will be called when the match finishes.
Parameters:
callback - An interface as wrapper for the callback function.

getNumberOfBoards

public int getNumberOfBoards()
Returns the number of boards that are to be played by the two pairs.
Returns:
The number of boards (should always equal to the number of boards per round of the movement of the tournament this instance belongs to).

getBoard

public Board getBoard(int index)
Returns the board that is stored at the given index. First the board at index 0 should be played, thereafter the board at index 1 and so on.
Parameters:
index - The index the wanted board is stored at.
Returns:
The desired board.

getNorthSouth

public Pair getNorthSouth()
Returns the pair that is seated north-south.
Returns:
The pair that is seated north-south.

getEastWest

public Pair getEastWest()
Returns the pair that is seated east-west.
Returns:
The pair that is seated east-west.

appealToJudge

public void appealToJudge(java.lang.String reason)
Description copied from interface: GameContainer
Appeal to a judge. This method gives players the possibility to request a judgement for a game. A reason for this has to be stated.
Specified by:
appealToJudge in interface GameContainer
Following copied from interface: de.kosi.model.game.GameContainer
Parameters:
reason - Reason for calling a judge.

gameFinished

public void gameFinished(Result result)
Called by the game when it has just been finished.
Specified by:
gameFinished in interface GameContainer
Parameters:
result - The result of the game.