org.vizzini.game
Class AbstractGame

java.lang.Object
  extended by org.vizzini.game.AbstractGame
All Implemented Interfaces:
IGame
Direct Known Subclasses:
AbstractBoardGame, DefaultGame

public abstract class AbstractGame
extends Object
implements IGame

Provides base functionality for games in the game framework. A game instance assembles the appropriate pieces to create a full game. These pieces consist of an engine, an environment, and an adjudicator.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Constructor Summary
AbstractGame()
           
 
Method Summary
 void configure()
          Configure this game.
 void configure(Properties properties)
          Configure this game.
protected  IEngine createEngine(Properties properties)
          Create the engine.
protected  IGameState createGameState(Properties properties)
          Create the game state.
 IAdjudicator getAdjudicator()
          Return the adjudicator.
 IEngine getEngine()
          Return the engine.
 IEnvironment getEnvironment()
          Return the environment.
 String getGameIdentifier()
          Return the game identifier.
 IGameState getGameState()
          Return the game state.
 Properties getProperties()
          Return the configuration properties.
 String getPropertiesPath()
          Return the path to the game properties.
protected  void loadProperties(Properties properties, String filepath)
          Load the given properties object from the given filepath.
 void open(File file)
          Open the game contained in the given file.
 void reset()
          Reset to the initial state.
 void save()
          Save the current game.
 void saveAs(File file)
          Save the current game to the given file.
 void setPropertiesPath(String propertiesPath)
          Set the path to the game properties.
 void start()
          Start the game.
 void stop()
          Stop the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGame

public AbstractGame()
Method Detail

configure

public void configure()
               throws InstantiationException,
                      IllegalAccessException
Configure this game.

Specified by:
configure in interface IGame
Throws:
InstantiationException
IllegalAccessException
Since:
v0.1

configure

public void configure(Properties properties)
               throws InstantiationException,
                      IllegalAccessException
Configure this game.

Specified by:
configure in interface IGame
Parameters:
properties - Source of configuration information.
Throws:
InstantiationException
IllegalAccessException
Since:
v0.1

getAdjudicator

public IAdjudicator getAdjudicator()
Return the adjudicator.

Specified by:
getAdjudicator in interface IGame
Since:
v0.1

getEngine

public IEngine getEngine()
Return the engine.

Specified by:
getEngine in interface IGame
Since:
v0.1

getEnvironment

public IEnvironment getEnvironment()
Return the environment.

Specified by:
getEnvironment in interface IGame
Since:
v0.1

getGameIdentifier

public String getGameIdentifier()
Return the game identifier.

Specified by:
getGameIdentifier in interface IGame
Since:
v0.1

getGameState

public IGameState getGameState()
Return the game state.

Specified by:
getGameState in interface IGame
Since:
v0.1

getProperties

public Properties getProperties()
Return the configuration properties.

Specified by:
getProperties in interface IGame
Since:
v0.1

getPropertiesPath

public String getPropertiesPath()
Return the path to the game properties.

Specified by:
getPropertiesPath in interface IGame
Since:
v0.1

open

public void open(File file)
          throws FileNotFoundException,
                 IOException,
                 ClassNotFoundException
Open the game contained in the given file.

Specified by:
open in interface IGame
Throws:
FileNotFoundException
IOException
ClassNotFoundException
Since:
v0.1

reset

public void reset()
Reset to the initial state.

Specified by:
reset in interface IGame
Since:
v0.1

save

public void save()
          throws FileNotFoundException,
                 IOException
Save the current game.

Specified by:
save in interface IGame
Throws:
FileNotFoundException
IOException
Since:
v0.1

saveAs

public void saveAs(File file)
            throws FileNotFoundException,
                   IOException
Save the current game to the given file.

Specified by:
saveAs in interface IGame
Throws:
FileNotFoundException
IOException
Since:
v0.1

setPropertiesPath

public void setPropertiesPath(String propertiesPath)
Set the path to the game properties.

Specified by:
setPropertiesPath in interface IGame
Since:
v0.1

start

public void start()
Start the game.

Specified by:
start in interface IGame
Since:
v0.1

stop

public void stop()
Stop the game.

Specified by:
stop in interface IGame
Since:
v0.1

createEngine

protected IEngine createEngine(Properties properties)
                        throws InstantiationException,
                               IllegalAccessException
Create the engine.

Parameters:
properties - Source of engine information.
Throws:
InstantiationException
IllegalAccessException
Since:
v0.1

createGameState

protected IGameState createGameState(Properties properties)
                              throws InstantiationException,
                                     IllegalAccessException
Create the game state.

Parameters:
properties - Source of game state information.
Throws:
InstantiationException
IllegalAccessException
Since:
v0.1

loadProperties

protected void loadProperties(Properties properties,
                              String filepath)
Load the given properties object from the given filepath.

Parameters:
properties - Properties object to load.
filepath - Source filepath.
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02