games.strategy.engine.delegate
Interface IDelegateBridge

All Known Implementing Classes:
DefaultDelegateBridge, TripleADelegateBridge

public interface IDelegateBridge

A class that communicates with the Delegate. DelegateBridge co-ordinates comunication between the Delegate and both the players and the game data. The reason for communicating through a DelegateBridge is to achieve network transparancy. The delegateBridge allows the Delegate to talk to the player in a safe manner.

Author:
Sean Bridges

Method Summary
 void addChange(Change aChange)
          Add a change to game data.
 void enterDelegateExecution()
           
 IChannelSubscribor getDisplayChannelBroadcaster()
          Return an object that implements the IDisplay interface for the game.
 IDelegateHistoryWriter getHistoryWriter()
          return the delegate history writer for this game.
 PlayerID getPlayerID()
           
 int[] getRandom(int max, int count, java.lang.String annotation)
          Return a random value to be used by the delegate.
 int getRandom(int max, java.lang.String annotation)
          equivalent to getRandom(max,1,annotation)[0]
 IRemote getRemote()
          equivalent to getRemote(getPlayerID())
 IRemote getRemote(PlayerID id)
          Get a remote reference to the given player.
 java.lang.String getStepName()
          Returns the current step name
 java.util.Properties getStepProperties()
           
 void leaveDelegateExecution()
           
 void stopGameSequence()
          After this step finishes executing, the next delegate will not be called.
 

Method Detail

getRemote

IRemote getRemote()
equivalent to getRemote(getPlayerID())

Returns:
remote for the current player.

getRemote

IRemote getRemote(PlayerID id)
Get a remote reference to the given player.

See Also:
IRemoteMessenger

getPlayerID

PlayerID getPlayerID()

getStepName

java.lang.String getStepName()
Returns the current step name


addChange

void addChange(Change aChange)
Add a change to game data. Use this rather than changing gameData directly since this method allows us to send the changes to other machines.

Parameters:
aChange -

getRandom

int getRandom(int max,
              java.lang.String annotation)
equivalent to getRandom(max,1,annotation)[0]


getRandom

int[] getRandom(int max,
                int count,
                java.lang.String annotation)
Return a random value to be used by the delegate.

Delegates should not use random data that comes from any other source.

Parameters:
annotation - - a string used to describe the random event.


getHistoryWriter

IDelegateHistoryWriter getHistoryWriter()
return the delegate history writer for this game.

The delegate history writer allows writing to the game history.


getDisplayChannelBroadcaster

IChannelSubscribor getDisplayChannelBroadcaster()
Return an object that implements the IDisplay interface for the game.

Methods called on this returned object will be invoked on all displays in the game, including those on remote machines


getStepProperties

java.util.Properties getStepProperties()
Returns:
the propertie for this step.


stopGameSequence

void stopGameSequence()
After this step finishes executing, the next delegate will not be called.

This methd allows the delegate to signal that the game is over, but does not force the ui or the display to shutdown.


leaveDelegateExecution

void leaveDelegateExecution()

enterDelegateExecution

void enterDelegateExecution()