|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.vizzini.game.AbstractEngine
public abstract class AbstractEngine
Provides base functionality for engines in the game framework. An engine instance encapsulates the game mechanics, meaning how the agents interact. Examples of engines include a synchronous engine, where agents take turns, a simultaneous engine, where each agent's actions occur at the same time, or an asynchronous engine, where the agent's actions occur at any time and any amount.
| Constructor Summary | |
|---|---|
AbstractEngine()
|
|
| Method Summary | |
|---|---|
void |
addGameListener(IGameListener listener)
Add the given listener. |
void |
configure(Properties properties)
Configure this engine. |
protected Thread |
createGameThread(IEngine engine)
Create the internal game thread. |
protected void |
cycleSleep(long start)
Sleep for long enough to bring the cycle time up to the minimum. |
protected ActionCollection |
getActionList()
Return the action list. |
IAgent |
getCurrentAgent()
Return the current agent. |
IEnvironment |
getEnvironment()
Return the environment. |
protected Thread |
getGameThread()
Return the game thread. |
long |
getMinCycleTime()
Return the minimum cycle time. |
boolean |
isFiringGameChanges()
Return true if this is set to fire game change events. |
boolean |
isGameOver()
Return true if the game is over. |
boolean |
isPaused()
Return true if this is paused. |
void |
pause()
Pause the engine. |
void |
removeGameListener(IGameListener listener)
Remove the given listener. |
void |
reset()
Reset to the initial state. |
void |
resume()
Resume the engine from a pause. |
protected void |
setCurrentAgent(IAgent agent)
Set the current agent. |
void |
setEnvironment(IEnvironment environment)
Set the environment to the given value. |
void |
setFiringGameChanges(boolean fire)
Set the flag which indicates whether to fire game change events. |
void |
setGameOver(boolean isGameOver,
IAgent winner)
Set the game over flag to the given value. |
void |
setMinCycleTime(long minCycleTime)
Set the minimum cycle time. |
void |
start()
Start the engine by starting the game loop thread. |
void |
step()
Step the engine. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.vizzini.game.IEngine |
|---|
run |
| Constructor Detail |
|---|
public AbstractEngine()
| Method Detail |
|---|
public void addGameListener(IGameListener listener)
addGameListener in interface IEngine
public void configure(Properties properties)
throws InstantiationException,
IllegalAccessException
configure in interface IEngineproperties - Source of configuration information.
InstantiationException
IllegalAccessExceptionpublic IAgent getCurrentAgent()
getCurrentAgent in interface IEnginepublic IEnvironment getEnvironment()
getEnvironment in interface IEnginepublic long getMinCycleTime()
getMinCycleTime in interface IEnginepublic boolean isFiringGameChanges()
isFiringGameChanges in interface IEnginepublic boolean isGameOver()
isGameOver in interface IEnginepublic boolean isPaused()
isPaused in interface IEnginepublic void pause()
pause in interface IEnginepublic void removeGameListener(IGameListener listener)
removeGameListener in interface IEnginepublic void reset()
reset in interface IEnginepublic void resume()
resume in interface IEnginepublic void setEnvironment(IEnvironment environment)
setEnvironment in interface IEngineenvironment - The new environment.public void setFiringGameChanges(boolean fire)
setFiringGameChanges in interface IEngine
public void setGameOver(boolean isGameOver,
IAgent winner)
setGameOver in interface IEngineisGameOver - The new value.public void setMinCycleTime(long minCycleTime)
setMinCycleTime in interface IEnginepublic void start()
start in interface IEnginepublic void step()
step in interface IEngineprotected Thread createGameThread(IEngine engine)
run
method.
engine - The owning engine.protected void cycleSleep(long start)
protected ActionCollection getActionList()
protected Thread getGameThread()
protected void setCurrentAgent(IAgent agent)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |