net.sf.freecol.server.ai
Class WorkLocationPlan

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.server.ai.AIObject
          extended by net.sf.freecol.server.ai.ValuedAIObject
              extended by net.sf.freecol.server.ai.WorkLocationPlan
All Implemented Interfaces:
java.lang.Comparable<ValuedAIObject>

public class WorkLocationPlan
extends ValuedAIObject

Objects of this class contains AI-information for a single WorkLocation.


Field Summary
private  GoodsType goodsType
           
private static java.util.logging.Logger logger
           
private  int priority
           
private  WorkLocation workLocation
          The FreeColGameObject this AIObject contains AI-information for.
 
Fields inherited from class net.sf.freecol.server.ai.AIObject
uninitialized
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG
 
Constructor Summary
WorkLocationPlan(AIMain aiMain, org.w3c.dom.Element element)
          Creates a new WorkLocationPlan.
WorkLocationPlan(AIMain aiMain, WorkLocation workLocation, GoodsType goodsType)
          Creates a new WorkLocationPlan.
 
Method Summary
 GoodsType getGoodsType()
          Gets the type of goods which should be produced at the WorkLocation.
 int getProductionOf(GoodsType goodsType)
          Gets the production of the given type of goods according to this WorkLocationPlan.
 WorkLocation getWorkLocation()
          Gets the WorkLocation this WorkLocationPlan controls.
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 WorkLocationPlan.
 void setGoodsType(GoodsType goodsType)
          Sets the type of goods to be produced at the WorkLocation.
 org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
          Creates an XML-representation of this object.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
 
Methods inherited from class net.sf.freecol.server.ai.ValuedAIObject
compareTo, getValue, setValue
 
Methods inherited from class net.sf.freecol.server.ai.AIObject
dispose, getAIMain, getGame, getSpecification, isUninitialized, readFromXML
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readAttributes, readAttributes, readChild, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

workLocation

private WorkLocation workLocation
The FreeColGameObject this AIObject contains AI-information for.


priority

private int priority

goodsType

private GoodsType goodsType
Constructor Detail

WorkLocationPlan

public WorkLocationPlan(AIMain aiMain,
                        WorkLocation workLocation,
                        GoodsType goodsType)
Creates a new WorkLocationPlan.

Parameters:
aiMain - The main AI-object.
workLocation - The WorkLocation to create a plan for.
goodsType - The goodsType to be produced on the workLocation using this plan.

WorkLocationPlan

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

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

getWorkLocation

public WorkLocation getWorkLocation()
Gets the WorkLocation this WorkLocationPlan controls.

Returns:
The WorkLocation.

getProductionOf

public int getProductionOf(GoodsType goodsType)
Gets the production of the given type of goods according to this WorkLocationPlan. The plan has been created for either a ColonyTile or a Building. If this is a plan for a ColonyTile then the maximum possible production of the tile gets returned, while the Building-plans only returns a number used for identifying the value of the goods produced.

Parameters:
goodsType - The type of goods to get the production for.
Returns:
The production.

getGoodsType

public GoodsType getGoodsType()
Gets the type of goods which should be produced at the WorkLocation.

Returns:
The type of goods.
See Also:
Goods, WorkLocation

setGoodsType

public void setGoodsType(GoodsType goodsType)
Sets the type of goods to be produced at the WorkLocation.

Parameters:
goodsType - The type of goods.
See Also:
Goods, WorkLocation

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
Description copied from class: FreeColObject
This method writes an XML-representation of this object to the given stream.

Specified by:
toXMLImpl in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

toXMLElement

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

Overrides:
toXMLElement in class FreeColObject
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 WorkLocationPlan.

Overrides:
readFromXMLElement in class FreeColObject
Parameters:
element - The XML-representation.

getXMLElementTagName

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

Returns:
"workLocationPlan"