net.sf.freecol.server.ai
Class WorkerWish

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.Wish
                  extended by net.sf.freecol.server.ai.WorkerWish
All Implemented Interfaces:
java.lang.Comparable<ValuedAIObject>

public class WorkerWish
extends Wish

Represents the need for a worker within a Colony.


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
WorkerWish(AIMain aiMain, org.w3c.dom.Element element)
          Creates a new WorkerWish from the given XML-representation.
WorkerWish(AIMain aiMain, Location destination, int value, UnitType unitType, boolean expertNeeded)
          Creates a new WorkerWish.
WorkerWish(AIMain aiMain, java.lang.String id)
          Creates a new WorkerWish from the given XML-representation.
WorkerWish(AIMain aiMain, javax.xml.stream.XMLStreamReader in)
          Creates a new WorkerWish from the given XML-representation.
 
Method Summary
 UnitType getUnitType()
          Returns the type of unit needed for releasing this wish.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 java.lang.String toString()
           
 void update(int value, UnitType unitType, boolean expertNeeded)
          Updates this WorkerWish with the given attributes.
 
Methods inherited from class net.sf.freecol.server.ai.Wish
dispose, getDestination, getTransportable, setTransportable, shouldBeStored
 
Methods inherited from class net.sf.freecol.server.ai.ValuedAIObject
compareTo, getValue, setValue
 
Methods inherited from class net.sf.freecol.server.ai.AIObject
getAIMain, getGame, isUninitialized, readFromXML
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkerWish

public WorkerWish(AIMain aiMain,
                  Location destination,
                  int value,
                  UnitType unitType,
                  boolean expertNeeded)
Creates a new WorkerWish.

Parameters:
aiMain - The main AI-object.
destination - The Location in which the transportable assigned to this WorkerWish will have to reach.
value - The value identifying the importance of this Wish.
unitType - The type of unit needed for releasing this wish completly.
expertNeeded - Determines wether the unitType is required or not.

WorkerWish

public WorkerWish(AIMain aiMain,
                  org.w3c.dom.Element element)
Creates a new WorkerWish from the given XML-representation.

Parameters:
aiMain - The main AI-object.
element - The root element for the XML-representation of a WorkerWish.

WorkerWish

public WorkerWish(AIMain aiMain,
                  java.lang.String id)
Creates a new WorkerWish from the given XML-representation.

Parameters:
aiMain - The main AI-object.
id - The unique ID of this object.

WorkerWish

public WorkerWish(AIMain aiMain,
                  javax.xml.stream.XMLStreamReader in)
           throws javax.xml.stream.XMLStreamException
Creates a new WorkerWish from the given XML-representation.

Parameters:
aiMain - The main AI-object.
in - The input stream containing the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.
Method Detail

update

public void update(int value,
                   UnitType unitType,
                   boolean expertNeeded)
Updates this WorkerWish with the given attributes.

Parameters:
value - The value identifying the importance of this Wish.
unitType - The type of unit needed for releasing this wish completly.
expertNeeded - Determines wether the unitType is required or not.

getUnitType

public UnitType getUnitType()
Returns the type of unit needed for releasing this wish.

Returns:
The type of unit.

getXMLElementTagName

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

Returns:
"workerWish"

toString

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