|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.farafin.snEADy.M_PlayerHandler
public final class M_PlayerHandler
M_PlayerHandler manages the player that should play the game. it is necessary to controll the threads and who is next to calculate.
Nested Class Summary | |
---|---|
private class |
M_PlayerHandler.PlayerInfo
informations for the player |
private class |
M_PlayerHandler.PlayerRun
realize the player handling TODO roland: make it more effective: dont need to make a new insrtance every time!! |
Field Summary | |
---|---|
private boolean |
imergencyPaused
flag if game was imergency paused |
protected static M_PlayerHandler |
instance
Comment for inst |
private int |
lastPlayer
Index of the last player who was calculated. |
private int |
nextMemCheck
for storing the information of which player should be controlled the space nextMemCheck |
private long |
nextSizeControllTime
the gameTime when the next time the size of player should be checked |
private GameParameter |
parameter
parameter set of GameParameter |
protected long |
playerCalculationtime
mesures the time a player needs to calculate its moove. |
protected M_PlayerHandler.PlayerInfo |
playerInfo
a prototype of playerInfo, so it doesnt need to be a new instance constructed every time. |
private Player[] |
playerInstances
Instances of the Player-Classes. |
private C_LogFileWriter |
playerLog
a logfile to safe the players moves |
private M_PlayerHandler.PlayerRun |
playerRun
the thread of the player who is actually calculated |
protected java.lang.Thread |
playerThread
the thread of the player who is actually calculated |
private java.util.Random |
randNumber
random number generator for controll time |
Constructor Summary | |
---|---|
private |
M_PlayerHandler()
default constructor |
Method Summary | |
---|---|
protected void |
abbort()
abborts the game |
protected void |
activateDeadline()
|
protected static void |
destroyInstance(M_PlayerHandler playerHandler)
|
protected static M_PlayerHandler |
getInstance()
prevents that more than one instance of the class exists in the program |
protected void |
imergencyPause()
|
protected void |
initGame(Player[] players)
|
protected void |
kill()
|
protected void |
recover(D_RecoverData recoverData)
|
private void |
reGenPlayerInfo(int playerIndex,
D_GameInfo gameInfo)
regenerate Player Info. it is no new instance build, but if the length some arrays doesnt fit, it will be renewed. |
protected void |
runPlayer(D_GameInfo gameInfo,
D_PlayerData[] playerData)
This methods organizes the player calculation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Player[] playerInstances
private int lastPlayer
private M_PlayerHandler.PlayerRun playerRun
protected java.lang.Thread playerThread
protected static M_PlayerHandler instance
inst
private boolean imergencyPaused
protected final M_PlayerHandler.PlayerInfo playerInfo
protected long playerCalculationtime
private C_LogFileWriter playerLog
private java.util.Random randNumber
private long nextSizeControllTime
private int nextMemCheck
private final GameParameter parameter
Constructor Detail |
---|
private M_PlayerHandler()
Method Detail |
---|
private void reGenPlayerInfo(int playerIndex, D_GameInfo gameInfo)
playerIndex
- gameInfo
- protected void initGame(Player[] players)
players
- protected void recover(D_RecoverData recoverData)
recoverData
- protected void activateDeadline()
protected void runPlayer(D_GameInfo gameInfo, D_PlayerData[] playerData)
gameInfo
- playerData
- protected void abbort()
protected void imergencyPause()
protected void kill()
protected static M_PlayerHandler getInstance()
protected static void destroyInstance(M_PlayerHandler playerHandler)
playerHandler
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |