org.vizzini.game
Class AbstractGameState

java.lang.Object
  extended by org.vizzini.util.AbstractDocument
      extended by org.vizzini.game.AbstractGameState
All Implemented Interfaces:
Serializable, IGameState, IDocument
Direct Known Subclasses:
DefaultGameState

public abstract class AbstractGameState
extends AbstractDocument
implements IGameState

Provides base functionality for game states in the game framework. A game state stores all the data necessary to reproduce a particular game state.

Since:
v0.1
Version:
v0.2
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Constructor Summary
AbstractGameState()
          Construct this object.
AbstractGameState(Object owner)
          Construct this object.
 
Method Summary
protected  void copy(IGameState gameState)
          Copy the given game state into this.
 boolean equals(Object object)
          Return true if the given object is equal to this.
 IAgentCollection getAgentCollection()
          Return the agent collection.
 String getGameIdentifier()
          Return the game identifier.
 ITokenCollection getTokenCollection()
          Return the token collection.
 long getTurnNumber()
          Return the turn number.
 int hashCode()
          Returns a hash code value for the object.
 void open()
          Open the associated file, thereby populating the document.
 void setAgentCollection(IAgentCollection agentCollection)
          Set the agent collection.
 void setGameIdentifier(String gameIdentifier)
          Set the game identifier.
 void setTokenCollection(ITokenCollection tokenCollection)
          Set the token collection.
 void setTurnNumber(long turnNumber)
          Set the turn number.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class org.vizzini.util.AbstractDocument
addDirtyListener, addFileListener, getDocument, getDocumentSupport, getFile, isDirty, isFileAssociated, isSaveable, removeDirtyListener, removeFileListener, reset, save, saveAs, setDirty, setDocument, setFile
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.util.IDocument
addDirtyListener, addFileListener, getFile, isDirty, isFileAssociated, isSaveable, removeDirtyListener, removeFileListener, reset, save, saveAs, setDirty, setFile
 

Constructor Detail

AbstractGameState

public AbstractGameState()
Construct this object.

Since:
v0.1

AbstractGameState

public AbstractGameState(Object owner)
Construct this object.

Since:
v0.1
Method Detail

setAgentCollection

public void setAgentCollection(IAgentCollection agentCollection)
Set the agent collection.

Specified by:
setAgentCollection in interface IGameState
Since:
v0.1

getAgentCollection

public IAgentCollection getAgentCollection()
Return the agent collection.

Specified by:
getAgentCollection in interface IGameState
Since:
v0.1

setGameIdentifier

public void setGameIdentifier(String gameIdentifier)
Set the game identifier.

Specified by:
setGameIdentifier in interface IGameState
Since:
v0.1

getGameIdentifier

public String getGameIdentifier()
Return the game identifier.

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

setTokenCollection

public void setTokenCollection(ITokenCollection tokenCollection)
Set the token collection.

Specified by:
setTokenCollection in interface IGameState
Since:
v0.1

getTokenCollection

public ITokenCollection getTokenCollection()
Return the token collection.

Specified by:
getTokenCollection in interface IGameState
Since:
v0.1

setTurnNumber

public void setTurnNumber(long turnNumber)
Set the turn number.

Specified by:
setTurnNumber in interface IGameState
Since:
v0.1

getTurnNumber

public long getTurnNumber()
Return the turn number.

Specified by:
getTurnNumber in interface IGameState
Since:
v0.1

equals

public boolean equals(Object object)
Return true if the given object is equal to this.

Overrides:
equals in class Object
Parameters:
object - The object to compare.
Since:
v0.1

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Since:
v0.1

open

public void open()
          throws FileNotFoundException,
                 IOException,
                 ClassNotFoundException
Open the associated file, thereby populating the document. File is a required property.

Specified by:
open in interface IDocument
Overrides:
open in class AbstractDocument
Throws:
FileNotFoundException
IOException
ClassNotFoundException
Since:
v0.1

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Since:
v0.1

copy

protected void copy(IGameState gameState)
Copy the given game state into this.

Since:
v0.1


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02