|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgames.strategy.engine.data.GameData
public class GameData
Central place to find all the information for a running game. Using this object you can find the territores, connections, production rules, unit types...
Threading. The game data, and all parts of the game data (such as Territories, Players, Units...) are protected by a read/write lock. If you are reading the game data, you should read while you have the read lock as below.
data.acquireReadLock();
try
{
//read data here
}
finally
{
data.releaseReadLock();
}
The exception is delegates within a start(), end() or any method called from an IGamePlayer through
the delgates remote interface. The delegate will have a read lock for the duration of those methods.
Non engine code must NOT acquire the games writeLock(). All changes to game Data must be made through a DelegateBridge or through a History object.
| Field Summary | |
|---|---|
static java.lang.String |
GAME_UUID
|
| Constructor Summary | |
|---|---|
GameData()
Creates new GameData |
|
| Method Summary | |
|---|---|
void |
acquireReadLock()
No changes to the game data should be made unless this lock is held. |
void |
acquireWriteLock()
No changes to the game data should be made unless this lock is held. |
void |
addDataChangeListener(GameDataChangeListener listener)
|
void |
addTerritoryListener(TerritoryListener listener)
|
boolean |
areChangesOnlyInSwingEventThread()
Should we throw an error if changes to this game data are made outside of the swing event thread. |
void |
clearAllListeners()
|
void |
forceChangesOnlyInSwingEventThread()
If set to true, then we will throw an error when the game data is changed outside the swing event thread. |
AllianceTracker |
getAllianceTracker()
Get the Alliance Tracker for the game. |
DelegateList |
getDelegateList()
|
IGameLoader |
getGameLoader()
|
java.lang.String |
getGameName()
|
Version |
getGameVersion()
|
History |
getHistory()
|
GameMap |
getMap()
Return the GameMap. |
PlayerList |
getPlayerList()
Get the list of Players in the game. |
ProductionFrontierList |
getProductionFrontierList()
Get the list of production Frontiers for this game. |
ProductionRuleList |
getProductionRuleList()
Get the list of Production Rules for the game. |
GameProperties |
getProperties()
|
RepairFrontierList |
getRepairFrontierList()
Get the list of production Frontiers for this game. |
RepairRuleList |
getRepairRuleList()
Get the list of Production Rules for the game. |
ResourceList |
getResourceList()
Get the list of resources available in the game. |
GameSequence |
getSequence()
|
UnitHolder |
getUnitHolder(java.lang.String name,
java.lang.String type)
|
UnitsList |
getUnits()
|
UnitTypeList |
getUnitTypeList()
|
void |
postDeSerialize()
Not to be called by mere mortals. |
void |
releaseReadLock()
|
void |
releaseWriteLock()
|
void |
removeDataChangeListener(GameDataChangeListener listener)
|
void |
removeTerritoryListener(TerritoryListener listener)
|
void |
testLocksOnRead()
On reads of the game data components, make sure that the read or write lock is held. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String GAME_UUID
| Constructor Detail |
|---|
public GameData()
| Method Detail |
|---|
public GameMap getMap()
public UnitsList getUnits()
public PlayerList getPlayerList()
public ResourceList getResourceList()
public ProductionFrontierList getProductionFrontierList()
public ProductionRuleList getProductionRuleList()
public RepairFrontierList getRepairFrontierList()
public RepairRuleList getRepairRuleList()
public AllianceTracker getAllianceTracker()
public boolean areChangesOnlyInSwingEventThread()
public void forceChangesOnlyInSwingEventThread()
public GameSequence getSequence()
public UnitTypeList getUnitTypeList()
public DelegateList getDelegateList()
public UnitHolder getUnitHolder(java.lang.String name,
java.lang.String type)
public GameProperties getProperties()
public void addTerritoryListener(TerritoryListener listener)
public void removeTerritoryListener(TerritoryListener listener)
public void addDataChangeListener(GameDataChangeListener listener)
public void removeDataChangeListener(GameDataChangeListener listener)
public IGameLoader getGameLoader()
public Version getGameVersion()
public java.lang.String getGameName()
public History getHistory()
public void postDeSerialize()
public void acquireReadLock()
public void releaseReadLock()
public void acquireWriteLock()
public void releaseWriteLock()
public void clearAllListeners()
public void testLocksOnRead()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||