games.strategy.engine.data
Class ChangeFactory

java.lang.Object
  extended by games.strategy.engine.data.ChangeFactory

public class ChangeFactory
extends java.lang.Object

All changes made to GameData should be made through changes produced here.
The way to change game data is to
1) Create a change with a ChangeFactory.change** or ChangeFactory.set** method
2) Execute that change through DelegateBridge.addChange()).

In this way changes to the game data can be co-ordinated across the network.

Version:
1.0
Author:
Sean Bridges

Field Summary
static Change EMPTY_CHANGE
           
 
Method Summary
static Change addAttachmentChange(IAttachment attachment, Attachable attachable, java.lang.String name)
           
static Change addProductionRule(ProductionRule rule, ProductionFrontier frontier)
           
static Change addUnits(PlayerID player, java.util.Collection<Unit> units)
           
static Change addUnits(Territory territory, java.util.Collection<Unit> units)
           
static Change attachmentPropertyChange(Attachable attatchment, java.lang.String attatchmentName, java.lang.Object newValue, java.lang.Object oldValue, java.lang.String property)
           
static Change attachmentPropertyChange(IAttachment attatchment, java.lang.Object newValue, java.lang.String property)
           
static Change changeGameSteps(GameSequence oldSequence, GameStep[] newSteps)
           
static Change changeOwner(java.util.Collection<Unit> units, PlayerID owner, Territory location)
           
static Change changeOwner(Territory territory, PlayerID owner)
           
static Change changeOwner(Unit unit, PlayerID owner, Territory location)
           
static Change changeProductionFrontier(PlayerID player, ProductionFrontier frontier)
           
static Change changeProductionFrontierChange(PlayerID player, ProductionFrontier newFrontier)
           
static Change changeResourcesChange(PlayerID player, Resource resource, int quantity)
           
static Change changeUnitProduction(Territory terr, int value)
           
static Change moveUnits(Territory start, Territory end, java.util.Collection<Unit> units)
           
static Change removeProductionRule(ProductionRule rule, ProductionFrontier frontier)
           
static Change removeUnits(PlayerID player, java.util.Collection<Unit> units)
           
static Change removeUnits(Territory territory, java.util.Collection<Unit> units)
           
static Change setProperty(java.lang.String property, java.lang.Object value, GameData data)
           
static Change unitPropertyChange(Unit unit, java.lang.Object newValue, java.lang.String propertyName)
           
static Change unitsHit(IntegerMap<Unit> newHits)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CHANGE

public static final Change EMPTY_CHANGE
Method Detail

changeOwner

public static Change changeOwner(Territory territory,
                                 PlayerID owner)

changeOwner

public static Change changeOwner(java.util.Collection<Unit> units,
                                 PlayerID owner,
                                 Territory location)

changeOwner

public static Change changeOwner(Unit unit,
                                 PlayerID owner,
                                 Territory location)

changeUnitProduction

public static Change changeUnitProduction(Territory terr,
                                          int value)

addUnits

public static Change addUnits(Territory territory,
                              java.util.Collection<Unit> units)

removeUnits

public static Change removeUnits(Territory territory,
                                 java.util.Collection<Unit> units)

addUnits

public static Change addUnits(PlayerID player,
                              java.util.Collection<Unit> units)

removeUnits

public static Change removeUnits(PlayerID player,
                                 java.util.Collection<Unit> units)

moveUnits

public static Change moveUnits(Territory start,
                               Territory end,
                               java.util.Collection<Unit> units)

changeProductionFrontier

public static Change changeProductionFrontier(PlayerID player,
                                              ProductionFrontier frontier)

changeResourcesChange

public static Change changeResourcesChange(PlayerID player,
                                           Resource resource,
                                           int quantity)

changeProductionFrontierChange

public static Change changeProductionFrontierChange(PlayerID player,
                                                    ProductionFrontier newFrontier)

setProperty

public static Change setProperty(java.lang.String property,
                                 java.lang.Object value,
                                 GameData data)

unitsHit

public static Change unitsHit(IntegerMap<Unit> newHits)

addProductionRule

public static Change addProductionRule(ProductionRule rule,
                                       ProductionFrontier frontier)

removeProductionRule

public static Change removeProductionRule(ProductionRule rule,
                                          ProductionFrontier frontier)

attachmentPropertyChange

public static Change attachmentPropertyChange(IAttachment attatchment,
                                              java.lang.Object newValue,
                                              java.lang.String property)

attachmentPropertyChange

public static Change attachmentPropertyChange(Attachable attatchment,
                                              java.lang.String attatchmentName,
                                              java.lang.Object newValue,
                                              java.lang.Object oldValue,
                                              java.lang.String property)

changeGameSteps

public static Change changeGameSteps(GameSequence oldSequence,
                                     GameStep[] newSteps)

unitPropertyChange

public static Change unitPropertyChange(Unit unit,
                                        java.lang.Object newValue,
                                        java.lang.String propertyName)

addAttachmentChange

public static Change addAttachmentChange(IAttachment attachment,
                                         Attachable attachable,
                                         java.lang.String name)