games.strategy.triplea.delegate
Class BattleDelegate

java.lang.Object
  extended by games.strategy.triplea.delegate.BattleDelegate
All Implemented Interfaces:
IDelegate, IRemote, IBattleDelegate

public class BattleDelegate
extends java.lang.Object
implements IDelegate, IBattleDelegate

Version:
1.0
Author:
Sean Bridges

Constructor Summary
BattleDelegate()
           
 
Method Summary
 void end()
          Called before the delegate will stop running.
 java.lang.String fightBattle(Territory territory, boolean bombing)
          Fight the battle in the given country
 IDelegateBridge getBattleBridge()
           
 BattleListing getBattles()
           
 BattleTracker getBattleTracker()
           
 Territory getCurentBattle()
           
 java.lang.String getDisplayName()
           
 java.lang.String getName()
           
 OriginalOwnerTracker getOriginalOwnerTracker()
           
 java.lang.Class<? extends IRemote> getRemoteType()
          Get the remote type of this delegate for use by a RemoteMessenger.
 void initialize(java.lang.String name, java.lang.String displayName)
           
 void loadState(java.io.Serializable aState)
          Loads the delegates state
 java.io.Serializable saveState()
          Returns the state of the Delegate.
 void start(IDelegateBridge aBridge, 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
 

Constructor Detail

BattleDelegate

public BattleDelegate()
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 aBridge,
                  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

fightBattle

public java.lang.String fightBattle(Territory territory,
                                    boolean bombing)
Description copied from interface: IBattleDelegate
Fight the battle in the given country

Specified by:
fightBattle in interface IBattleDelegate
Parameters:
territory - - where to fight
bombing - - fight a bombing raid
Returns:
an error string if the battle could not be fought or an error occured, null otherwse

getBattles

public BattleListing getBattles()
Specified by:
getBattles in interface IBattleDelegate
Returns:
the battles currently waiting to be fought

end

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

Specified by:
end in interface IDelegate

getBattleTracker

public BattleTracker getBattleTracker()

getBattleBridge

public IDelegateBridge getBattleBridge()

getOriginalOwnerTracker

public OriginalOwnerTracker getOriginalOwnerTracker()

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 aState)
Loads the delegates state

Specified by:
loadState in interface IDelegate

getRemoteType

public java.lang.Class<? extends IRemote> getRemoteType()
Description copied from interface: IDelegate
Get the remote type of this delegate for use by a RemoteMessenger. Class must be an interface that extends IRemote If the return value is null, then it indicates that this delegate should not be used as in IRemote.

Specified by:
getRemoteType in interface IDelegate

getCurentBattle

public Territory getCurentBattle()
Specified by:
getCurentBattle in interface IBattleDelegate
Returns:
The location of the currently being fought battle, or null if no battle is in progress.