games.strategy.triplea.delegate
Class TransportTracker

java.lang.Object
  extended by games.strategy.triplea.delegate.TransportTracker

public class TransportTracker
extends java.lang.Object

Version:
1.0 Tracks which transports are carrying which units. Also tracks the capacity that has been unloaded. To reset the unloaded call clearUnloadedCapacity().
Author:
Sean Bridges

Constructor Summary
TransportTracker()
          Constructor.
 
Method Summary
 Change combatTransportChange(TripleAUnit transport, PlayerID id)
           
 Change endOfRoundClearStateChange(GameData data)
           
 int getAvailableCapacity(Unit unit)
           
static int getCost(java.util.Collection<Unit> units)
           
 Territory getTerritoryTransportHasUnloadedTo(Unit transport)
           
 java.util.Collection<Unit> getUnitsLoadedOnAlliedTransportsThisTurn(java.util.Collection<Unit> units)
           
 boolean hasTransportUnloadedInPreviousPhase(Unit transport)
           
 boolean isTransporting(Unit transport)
           
 boolean isTransportUnloadRestrictedInNonCombat(Unit transport)
           
 boolean isTransportUnloadRestrictedToAnotherTerritory(Unit transport, Territory territory)
           
 Change loadTransportChange(TripleAUnit transport, Unit unit, PlayerID id)
           
 Unit transportedBy(Unit unit)
          Return the transport that holds the given unit.
 java.util.Map<Unit,java.util.Collection<Unit>> transporting(java.util.Collection<Unit> units)
          Returns a map of transport -> collection of transported units.
 java.util.Collection<Unit> transporting(Unit transport)
          Returns the collection of units that the given transport is transporting.
 java.util.Collection<Unit> transportingAndUnloaded(Unit transport)
           
 java.util.Collection<Unit> unloaded(Unit transport)
          Returns the collection of units that the given transport has unloaded this turn.
 Change unloadTransportChange(TripleAUnit unit, Territory territory, PlayerID id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportTracker

public TransportTracker()
Constructor.

Method Detail

getCost

public static int getCost(java.util.Collection<Unit> units)

transporting

public java.util.Collection<Unit> transporting(Unit transport)
Returns the collection of units that the given transport is transporting. Could be null.


isTransporting

public boolean isTransporting(Unit transport)

unloaded

public java.util.Collection<Unit> unloaded(Unit transport)
Returns the collection of units that the given transport has unloaded this turn. Could be empty.


transportingAndUnloaded

public java.util.Collection<Unit> transportingAndUnloaded(Unit transport)

transporting

public java.util.Map<Unit,java.util.Collection<Unit>> transporting(java.util.Collection<Unit> units)
Returns a map of transport -> collection of transported units.


transportedBy

public Unit transportedBy(Unit unit)
Return the transport that holds the given unit. Could be null.


unloadTransportChange

public Change unloadTransportChange(TripleAUnit unit,
                                    Territory territory,
                                    PlayerID id)

loadTransportChange

public Change loadTransportChange(TripleAUnit transport,
                                  Unit unit,
                                  PlayerID id)

combatTransportChange

public Change combatTransportChange(TripleAUnit transport,
                                    PlayerID id)

getAvailableCapacity

public int getAvailableCapacity(Unit unit)

endOfRoundClearStateChange

public Change endOfRoundClearStateChange(GameData data)

getUnitsLoadedOnAlliedTransportsThisTurn

public java.util.Collection<Unit> getUnitsLoadedOnAlliedTransportsThisTurn(java.util.Collection<Unit> units)

hasTransportUnloadedInPreviousPhase

public boolean hasTransportUnloadedInPreviousPhase(Unit transport)

isTransportUnloadRestrictedToAnotherTerritory

public boolean isTransportUnloadRestrictedToAnotherTerritory(Unit transport,
                                                             Territory territory)

getTerritoryTransportHasUnloadedTo

public Territory getTerritoryTransportHasUnloadedTo(Unit transport)

isTransportUnloadRestrictedInNonCombat

public boolean isTransportUnloadRestrictedInNonCombat(Unit transport)