games.strategy.triplea.delegate
Class BattleTracker

java.lang.Object
  extended by games.strategy.triplea.delegate.BattleTracker
All Implemented Interfaces:
java.io.Serializable

public class BattleTracker
extends java.lang.Object
implements java.io.Serializable

Version:
1.0 Used to keep track of where battles have occurred
Author:
Sean Bridges
See Also:
Serialized Form

Constructor Summary
BattleTracker()
           
 
Method Summary
 void addBattle(Route route, java.util.Collection<Unit> units, boolean bombing, PlayerID id, GameData data, IDelegateBridge bridge, UndoableMove changeTracker)
           
 void addPreviouslyNavalBombardmentSource(java.util.Collection<Territory> territories)
          Marks the set of territories as having been the source of a naval bombardment.
 void clear()
           
 java.util.Collection<games.strategy.triplea.delegate.Battle> getBlocked(games.strategy.triplea.delegate.Battle blocking)
          return the battles that cannot occur until the given battle occurs.
 java.util.Collection<games.strategy.triplea.delegate.Battle> getDependentOn(games.strategy.triplea.delegate.Battle blocked)
          Returns the battle that must occur before dependent can occur
 games.strategy.triplea.delegate.Battle getPendingBattle(Territory t, boolean bombing)
           
 java.util.Collection<Territory> getPendingBattleSites(boolean bombing)
          Returns a collection of Territories where battles are pending.
 boolean hasPendingBattle(Territory t, boolean bombing)
          True if a battle is to be fought in the given territory.
 void removeBattle(games.strategy.triplea.delegate.Battle battle)
           
protected  void takeOver(Territory territory, PlayerID id, IDelegateBridge bridge, GameData data, UndoableMove changeTracker, java.util.Collection<Unit> arrivingUnits)
           
 java.lang.String toString()
           
 void undoBattle(Route route, java.util.Collection<Unit> units, PlayerID player, GameData data, IDelegateBridge bridge)
           
 boolean wasBattleFought(Territory t)
           
 boolean wasBlitzed(Territory t)
          True if the territory was conquered.
 boolean wasConquered(Territory t)
          True if the territory was conquered.
 boolean wasNavalBombardmentSource(Territory territory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BattleTracker

public BattleTracker()
Method Detail

hasPendingBattle

public boolean hasPendingBattle(Territory t,
                                boolean bombing)
True if a battle is to be fought in the given territory.


wasConquered

public boolean wasConquered(Territory t)
True if the territory was conquered.


wasBlitzed

public boolean wasBlitzed(Territory t)
True if the territory was conquered.


wasBattleFought

public boolean wasBattleFought(Territory t)

undoBattle

public void undoBattle(Route route,
                       java.util.Collection<Unit> units,
                       PlayerID player,
                       GameData data,
                       IDelegateBridge bridge)

addBattle

public void addBattle(Route route,
                      java.util.Collection<Unit> units,
                      boolean bombing,
                      PlayerID id,
                      GameData data,
                      IDelegateBridge bridge,
                      UndoableMove changeTracker)

takeOver

protected void takeOver(Territory territory,
                        PlayerID id,
                        IDelegateBridge bridge,
                        GameData data,
                        UndoableMove changeTracker,
                        java.util.Collection<Unit> arrivingUnits)

getPendingBattle

public games.strategy.triplea.delegate.Battle getPendingBattle(Territory t,
                                                               boolean bombing)

getPendingBattleSites

public java.util.Collection<Territory> getPendingBattleSites(boolean bombing)
Returns a collection of Territories where battles are pending.


getDependentOn

public java.util.Collection<games.strategy.triplea.delegate.Battle> getDependentOn(games.strategy.triplea.delegate.Battle blocked)
Returns the battle that must occur before dependent can occur


getBlocked

public java.util.Collection<games.strategy.triplea.delegate.Battle> getBlocked(games.strategy.triplea.delegate.Battle blocking)
return the battles that cannot occur until the given battle occurs.


removeBattle

public void removeBattle(games.strategy.triplea.delegate.Battle battle)

addPreviouslyNavalBombardmentSource

public void addPreviouslyNavalBombardmentSource(java.util.Collection<Territory> territories)
Marks the set of territories as having been the source of a naval bombardment.


wasNavalBombardmentSource

public boolean wasNavalBombardmentSource(Territory territory)

clear

public void clear()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object