de.kosi.model.tournament
Class TournamentImpl

java.lang.Object
  |
  +--de.kosi.model.tournament.TournamentImpl
All Implemented Interfaces:
java.io.Serializable, Tournament
Direct Known Subclasses:
PairTournamentImpl

public abstract class TournamentImpl
extends java.lang.Object
implements Tournament

This class implements the Tournament interface. See there for additional information.

ChangeLog:

 $Log: TournamentImpl.java,v $
 Revision 1.7  2001/08/02 10:44:30  jiriki
 Worked on Tournament

 Revision 1.6  2001/08/02 10:09:16  betacarotine
 Started implementing the preparetion of a tournament (form pairs etc.)

 Revision 1.5  2001/08/02 09:33:53  jiriki
 Worked on tournament

 Revision 1.4  2001/07/31 13:00:27  jiriki
 Worked on Tournament

 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.6  2001/04/25 12:05:40  login
 Worked on TournamentImpl

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

 Revision 1.4  2001/04/17 20:19:13  wombat
 Updated documentation.

 Revision 1.3  2001/04/09 13:03:10  wombat
 Removed timeout from threadpool (did not work)

 Revision 1.2  2001/04/05 14:11:52  login
 Worked on Tournament

 Revision 1.1  2001/03/05 20:55:22  login
 - Game (und zugehoerige Klassen) soweit fertig
 - package de.kosi.model.tournament angelegt
 - Pair angelegt
 - Round angelegt
 - Movement-Interface angelegt
 - KosiMovement fertig!!! :-)
 - KosiMovementTest um das KosiMovement zu testen
       (kann mit KOSI/kosimovementtest  aufgerufen werden)
 - Tournament und TournamentImpl in das package de.kosi.model.tournament
       verschoben
 - buildfile fuer die neuen klassen angepasst

 Revision 1.3  2001/02/11 18:47:25  login
 updated docu


 

Version:
$Revision: 1.7 $ ($Date: 2001/08/02 10:44:30 $)
Author:
Timo, Niklas, Ole
See Also:
Serialized Form

Field Summary
protected  ListenerList listenerList
          List of listeners to the tournament.
 
Fields inherited from interface de.kosi.model.tournament.Tournament
APPLICATION, EXECUTION, FINISHED, PREPARATION
 
Constructor Summary
TournamentImpl()
          Creates a new TournamentImpl that should be inserted into the given list and hass the given owner.
 
Method Summary
 void addTournamentListener(TournamentListener listener)
          Adds a listener to this tournament.
 void appealToJudge(java.lang.String reason)
          Appeal to a judge.
abstract  void calculateResults()
          Calculate the Result of the tournament.
protected  void checkAccess()
          Checks if the caller of the method is owner of this tournament.
abstract  Movement createMovement()
          Creates the movement for this tournament.
 java.util.Calendar getApplicationDeadline()
          Returns the applicationd eadline of this tournament.
 ChatChannel getChatChannel()
          Returns the chat channel that belongs to this tournament.
 long getMatchTimeout()
          Returns the timeout for matches.
 java.lang.String getOwnerName()
          Returns the name of the owner of this tournament.
 java.util.Calendar getStartDate()
          Returns the start date of this tournament.
 int getStatus()
          Returns the status of this tournament.
 void init(DistributedListImpl tournamentList, UserImpl owner)
           
 boolean isOwner()
          Return wether the User calling the method is the owner of this tournament.
abstract  void prepare()
           
 void removeTournamentListener(TournamentListener listener)
          Remove a listener from the tournament.
 void setApplicationDeadline(java.util.Calendar calendar)
          Sets the applicationd eadline of this tournament.
 void setMatchTimeout(long timeout)
          Set the timeout for matches.
 void setStartDate(java.util.Calendar calendar)
          Sets the start date of this tournament.
 void setUserGame(UserImpl user, GameImpl game)
          Set the current Game of a user.
 void start()
          Start the tournament.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.kosi.model.tournament.Tournament
getConfiguration
 

Field Detail

listenerList

protected transient ListenerList listenerList
List of listeners to the tournament.
Constructor Detail

TournamentImpl

public TournamentImpl()
               throws java.rmi.RemoteException
Creates a new TournamentImpl that should be inserted into the given list and hass the given owner.
Parameters:
tournamentList - The list that contains all tournaments. It is this tournament's own responsibility to insert itself into the list.
Throws:
java.rmi.RemoteException - If RMI runs into trouble.
Method Detail

init

public void init(DistributedListImpl tournamentList,
                 UserImpl owner)

setUserGame

public void setUserGame(UserImpl user,
                        GameImpl game)
Set the current Game of a user.
Parameters:
user - User whos game is set.
game - The current game of the user.

getChatChannel

public ChatChannel getChatChannel()
Returns the chat channel that belongs to this tournament.
Specified by:
getChatChannel in interface Tournament
Returns:
A chat channel.

createMovement

public abstract Movement createMovement()
Creates the movement for this tournament. This has to be implemented by concrete implementations.
Returns:
A new Movement.

getStartDate

public java.util.Calendar getStartDate()
Returns the start date of this tournament.
Specified by:
getStartDate in interface Tournament
Returns:
Calender containing the start date of this tournament.

setStartDate

public void setStartDate(java.util.Calendar calendar)
                  throws KosiAccessException,
                         InvalidSessionException
Sets the start date of this tournament.
Specified by:
setStartDate in interface Tournament
Parameters:
calendar - Calender containing the start date of this tournament.
Throws:
KosiAccessException - If not called by the owner of this tournament.
InvalidSessionException - If not called from a valid session context.

getApplicationDeadline

public java.util.Calendar getApplicationDeadline()
Returns the applicationd eadline of this tournament.
Specified by:
getApplicationDeadline in interface Tournament
Returns:
Calendar containing the application deadline.

setApplicationDeadline

public void setApplicationDeadline(java.util.Calendar calendar)
                            throws KosiAccessException,
                                   InvalidSessionException
Sets the applicationd eadline of this tournament.
Specified by:
setApplicationDeadline in interface Tournament
Parameters:
calendar - Calendar containing the application deadline.
Throws:
KosiAccessException - If not called by the owner of this tournament.
InvalidSessionException - If not called from a valid session context.

getMatchTimeout

public long getMatchTimeout()
Returns the timeout for matches. When the timeout expires all matches are ended.
Specified by:
getMatchTimeout in interface Tournament
Returns:
Timeout in milliseconds.

setMatchTimeout

public void setMatchTimeout(long timeout)
                     throws KosiAccessException,
                            InvalidSessionException
Set the timeout for matches. When the timeout expires all matches are ended.
Specified by:
setMatchTimeout in interface Tournament
Parameters:
timeout - Timeout in milliseconds.
Throws:
KosiAccessException - If not called by the owner of this tournament.
InvalidSessionException - If not called from a valid session context.

checkAccess

protected void checkAccess()
                    throws KosiAccessException,
                           InvalidSessionException
Checks if the caller of the method is owner of this tournament.
Throws:
KosiAccessException - If not called by the owner of this tournament.
InvalidSessionException - If not called from a valid session context.

getOwnerName

public java.lang.String getOwnerName()
Returns the name of the owner of this tournament.
Specified by:
getOwnerName in interface Tournament
Returns:
Name of the owner.

isOwner

public boolean isOwner()
                throws java.rmi.RemoteException,
                       InvalidSessionException
Return wether the User calling the method is the owner of this tournament.
Specified by:
isOwner in interface Tournament
Returns:
The tournament's owner's login name.
Throws:
java.rmi.RemoteException - If the remote call fails.
InvalidSessionException - If not called from a valid session context.

getStatus

public int getStatus()
Returns the status of this tournament.
Specified by:
getStatus in interface Tournament
Returns:
One of the constants APPLICATION, PREPARATION, EXECUTION or FINISHED

addTournamentListener

public void addTournamentListener(TournamentListener listener)
                           throws InvalidSessionException
Adds a listener to this tournament.
Specified by:
addTournamentListener in interface Tournament
Parameters:
listener - Listener to be informed about events in the tournament.
Throws:
InvalidSessionException - If not called from a valid session context.

removeTournamentListener

public void removeTournamentListener(TournamentListener listener)
                              throws InvalidSessionException
Remove a listener from the tournament.
Specified by:
removeTournamentListener in interface Tournament
Parameters:
listener - Listener to be removed.
Throws:
InvalidSessionException - If not called from a valid session context.

start

public void start()
Start the tournament.

calculateResults

public abstract void calculateResults()
Calculate the Result of the tournament.

prepare

public abstract void prepare()

appealToJudge

public void appealToJudge(java.lang.String reason)
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.
Parameters:
reason - Reason for calling a judge.