games.strategy.common.delegate
Class BaseDelegate

java.lang.Object
  extended by games.strategy.common.delegate.BaseDelegate
All Implemented Interfaces:
IDelegate
Direct Known Subclasses:
EndTurnDelegate, InitializationDelegate, PlayDelegate

public abstract class BaseDelegate
extends java.lang.Object
implements IDelegate

Base class designed to make writing custom delegates simpler. Code common to all delegates is implemented here.

Author:
Lane Schwartz

Field Summary
protected  IDelegateBridge m_bridge
           
protected  GameData m_data
           
protected  java.lang.String m_displayName
           
protected  java.lang.String m_name
           
protected  PlayerID m_player
           
 
Constructor Summary
BaseDelegate()
          Creates a new instance of the Delegate
 
Method Summary
 void end()
          Called before the delegate will stop running.
 java.lang.String getDisplayName()
           
 java.lang.String getName()
           
abstract  java.lang.Class<? extends IRemote> getRemoteType()
          If this class implements an interface which inherits from IRemote, returns the class of that interface.
 void initialize(java.lang.String name, java.lang.String displayName)
           
 void loadState(java.io.Serializable state)
          Loads the delegates state
 java.io.Serializable saveState()
          Returns the state of the Delegate.
 void start(IDelegateBridge bridge, GameData gameData)
          Called before the delegate will run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_name

protected java.lang.String m_name

m_displayName

protected java.lang.String m_displayName

m_player

protected PlayerID m_player

m_bridge

protected IDelegateBridge m_bridge

m_data

protected GameData m_data
Constructor Detail

BaseDelegate

public BaseDelegate()
Creates a new instance of the Delegate

Method Detail

initialize

public void initialize(java.lang.String name,
                       java.lang.String displayName)
Specified by:
initialize in interface IDelegate

start

public void start(IDelegateBridge bridge,
                  GameData gameData)
Called before the delegate will run.

Specified by:
start in interface IDelegate

getName

public java.lang.String getName()
Specified by:
getName in interface IDelegate

getDisplayName

public java.lang.String getDisplayName()
Specified by:
getDisplayName in interface IDelegate

end

public void end()
Called before the delegate will stop running.

Specified by:
end in interface IDelegate

saveState

public java.io.Serializable saveState()
Returns the state of the Delegate.

Specified by:
saveState in interface IDelegate

loadState

public void loadState(java.io.Serializable state)
Loads the delegates state

Specified by:
loadState in interface IDelegate

getRemoteType

public abstract java.lang.Class<? extends IRemote> getRemoteType()
If this class implements an interface which inherits from IRemote, returns the class of that interface. Otherwise, returns null.

Specified by:
getRemoteType in interface IDelegate