de.hagenah.diplomacy.game
Class GameGroup

java.lang.Object
  extended by de.hagenah.diplomacy.game.GameGroup
All Implemented Interfaces:
GameHandler, java.io.Serializable
Direct Known Subclasses:
DipGameGroup

public class GameGroup
extends java.lang.Object
implements GameHandler, java.io.Serializable

This is the standard implementation for the GameHandler interface.

See Also:
Serialized Form

Constructor Summary
GameGroup()
           
 
Method Summary
 Game createGame(java.lang.String name, java.lang.String judge, java.lang.String map)
          Retrieves the specified game.
protected  MapData createMap(java.lang.String name)
          Retrieves the specified map.
 Game getGame(java.lang.String name, java.lang.String judge)
          Retrieves the game.
 int getGameIndex(java.lang.String name, java.lang.String judge)
          Retrieves the index of a game.
 java.util.Collection getGames()
          Retrieves all games.
 java.lang.String getMapPath()
          Returns the map path.
 java.lang.String getMapURL(java.lang.String name)
          Returns the URL for the map name.
protected  Game internCreateGame(java.lang.String name, java.lang.String judge, MapData map)
          Creates a Game object
 void processGames()
          Calculates all data that can be calculated from the existing data.
 void removeGame(java.lang.String name, java.lang.String judge)
          Removes the game
 void renameGame(java.lang.String oldname, java.lang.String oldjudge, java.lang.String newname, java.lang.String newjudge)
          Renames a game
 void setMapPath(java.lang.String mappath)
          Sets the map path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameGroup

public GameGroup()
Method Detail

internCreateGame

protected Game internCreateGame(java.lang.String name,
                                java.lang.String judge,
                                MapData map)
Creates a Game object


createMap

protected MapData createMap(java.lang.String name)
                     throws java.lang.Exception
Retrieves the specified map. If it does not exist it is loaded.

Throws:
java.lang.Exception

getMapURL

public java.lang.String getMapURL(java.lang.String name)
                           throws java.io.IOException
Returns the URL for the map name. The default implementation tries to load the resource "/"+MapPath+"/"+name+".xml".

Throws:
java.io.IOException

getMapPath

public final java.lang.String getMapPath()
Returns the map path.


setMapPath

public final void setMapPath(java.lang.String mappath)
Sets the map path.


getGames

public java.util.Collection getGames()
Retrieves all games.


getGame

public Game getGame(java.lang.String name,
                    java.lang.String judge)
Retrieves the game.


getGameIndex

public int getGameIndex(java.lang.String name,
                        java.lang.String judge)
Retrieves the index of a game.


createGame

public Game createGame(java.lang.String name,
                       java.lang.String judge,
                       java.lang.String map)
                throws java.lang.Exception
Retrieves the specified game. If it does not exist it is created.

Specified by:
createGame in interface GameHandler
Parameters:
name - The name of the game (!=null).
judge - The name of the judge (!=null).
map - The name of the map.
Returns:
The game (!=null).
Throws:
java.lang.Exception

processGames

public void processGames()
Calculates all data that can be calculated from the existing data.


removeGame

public void removeGame(java.lang.String name,
                       java.lang.String judge)
Removes the game


renameGame

public void renameGame(java.lang.String oldname,
                       java.lang.String oldjudge,
                       java.lang.String newname,
                       java.lang.String newjudge)
Renames a game