net.sf.freecol.server.ai
Class ColonyPlan

java.lang.Object
  extended by net.sf.freecol.server.ai.ColonyPlan

public class ColonyPlan
extends java.lang.Object

Objects of this class describes the plan the AI has for a Colony.

A ColonyPlan contains WorkLocationPlans which defines the production of each Building and ColonyTile.

See Also:
Colony

Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String LICENSE
           
static java.lang.String REVISION
           
 
Constructor Summary
ColonyPlan(AIMain aiMain, Colony colony)
          Creates a new ColonyPlan.
ColonyPlan(AIMain aiMain, org.w3c.dom.Element element)
          Creates a new ColonyPlan.
 
Method Summary
 void create()
          Creates a plan for this colony.
 AIMain getAIMain()
          Gets the main AI-object.
 java.util.Iterator<java.lang.Integer> getBuildable()
          Gets an Iterator for everything to be built in the Colony.
 Colony getColony()
          Gets the Colony this ColonyPlan controls.
 Game getGame()
          Get the Game this object is associated to.
 int getProductionOf(int goodsType)
          Returns the production of the given type of goods accoring to this plan.
 java.util.List<WorkLocationPlan> getSortedWorkLocationPlans()
          Returns the WorkLocationPlans associated with this ColonyPlan sorted by production in a decreasing order.
 java.util.List<WorkLocationPlan> getWorkLocationPlans()
          Returns the WorkLocationPlans associated with this ColonyPlan.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 void readFromXMLElement(org.w3c.dom.Element element)
          Updates this object from an XML-representation of a ColonyPlan.
 org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
          Creates an XML-representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

LICENSE

public static final java.lang.String LICENSE
See Also:
Constant Field Values

REVISION

public static final java.lang.String REVISION
See Also:
Constant Field Values
Constructor Detail

ColonyPlan

public ColonyPlan(AIMain aiMain,
                  Colony colony)
Creates a new ColonyPlan.

Parameters:
aiMain - The main AI-object.
colony - The colony to make a ColonyPlan for.

ColonyPlan

public ColonyPlan(AIMain aiMain,
                  org.w3c.dom.Element element)
Creates a new ColonyPlan.

Parameters:
aiMain - The main AI-object.
element - An Element containing an XML-representation of this object.
Method Detail

getWorkLocationPlans

public java.util.List<WorkLocationPlan> getWorkLocationPlans()
Returns the WorkLocationPlans associated with this ColonyPlan.

Returns:
The list of WorkLocationPlans .

getSortedWorkLocationPlans

public java.util.List<WorkLocationPlan> getSortedWorkLocationPlans()
Returns the WorkLocationPlans associated with this ColonyPlan sorted by production in a decreasing order.

Returns:
The list of WorkLocationPlans .

getBuildable

public java.util.Iterator<java.lang.Integer> getBuildable()
Gets an Iterator for everything to be built in the Colony.

Returns:
An iterator containing all the Buildable sorted by priority (highest priority first).

getAIMain

public AIMain getAIMain()
Gets the main AI-object.

Returns:
The main AI-object.

getGame

public Game getGame()
Get the Game this object is associated to.

Returns:
The Game.

create

public void create()
Creates a plan for this colony. That is; determines what type of goods each tile should produce and what type of goods that should be manufactored.


getProductionOf

public int getProductionOf(int goodsType)
Returns the production of the given type of goods accoring to this plan.

Parameters:
goodsType - The type of goods to check the production for.
Returns:
The maximum possible production of the given type of goods according to this ColonyPlan.

getColony

public Colony getColony()
Gets the Colony this ColonyPlan controls.

Returns:
The Colony.

toXMLElement

public org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
Creates an XML-representation of this object.

Parameters:
document - The Document in which the XML-representation should be created.
Returns:
The XML-representation.

readFromXMLElement

public void readFromXMLElement(org.w3c.dom.Element element)
Updates this object from an XML-representation of a ColonyPlan.

Parameters:
element - The XML-representation.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
"colonyPlan"