net.sf.freecol.server.ai
Class TileImprovementPlan

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.TileImprovementPlan
All Implemented Interfaces:
java.lang.Comparable<ValuedAIObject>

public class TileImprovementPlan
extends ValuedAIObject

Represents a Tile which should be improved in some way. For instance by plowing or by building a road.

See Also:
Tile

Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
TileImprovementPlan(AIMain aiMain, org.w3c.dom.Element element)
          Creates a new TileImprovementPlan from the given XML-representation.
TileImprovementPlan(AIMain aiMain, java.lang.String id)
          Creates a new TileImprovementPlan from the given XML-representation.
TileImprovementPlan(AIMain aiMain, Tile target, TileImprovementType type, int value)
          Creates a new TileImprovementPlan.
TileImprovementPlan(AIMain aiMain, javax.xml.stream.XMLStreamReader in)
          Creates a new TileImprovementPlan from the given XML-representation.
 
Method Summary
 void dispose()
          Disposes this TileImprovementPlan.
 AIUnit getPioneer()
          Gets the pioneer who have been assigned to making the improvement described by this object.
 Tile getTarget()
          Gets the target of this TileImprovementPlan.
 TileImprovementType getType()
          Returns the TileImprovementType of this plan.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 void setPioneer(AIUnit pioneer)
          Sets the pioneer who have been assigned to making the improvement described by this object.
 void setType(TileImprovementType type)
          Sets the type of this TileImprovementPlan.
 java.lang.String toString()
           
 
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

TileImprovementPlan

public TileImprovementPlan(AIMain aiMain,
                           Tile target,
                           TileImprovementType type,
                           int value)
Creates a new TileImprovementPlan.

Parameters:
aiMain - The main AI-object.
target - The target Tile for the improvement.
type - The type of improvement.
value - The value identifying the importance of this TileImprovementPlan - a higher value signals a higher importance.

TileImprovementPlan

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

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

TileImprovementPlan

public TileImprovementPlan(AIMain aiMain,
                           javax.xml.stream.XMLStreamReader in)
                    throws javax.xml.stream.XMLStreamException
Creates a new TileImprovementPlan 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.

TileImprovementPlan

public TileImprovementPlan(AIMain aiMain,
                           java.lang.String id)
                    throws javax.xml.stream.XMLStreamException
Creates a new TileImprovementPlan from the given XML-representation.

Parameters:
aiMain - The main AI-object.
id - The ID.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.
Method Detail

dispose

public void dispose()
Disposes this TileImprovementPlan. If a pioneer has been assigned to making this improvement, then this pioneer gets informed that the improvement is no longer wanted.

Overrides:
dispose in class AIObject

getPioneer

public AIUnit getPioneer()
Gets the pioneer who have been assigned to making the improvement described by this object.

Returns:
The pioneer which should make the improvement, if such a AIUnit has been assigned, and null if nobody has been assigned this mission.

setPioneer

public void setPioneer(AIUnit pioneer)
Sets the pioneer who have been assigned to making the improvement described by this object.

Parameters:
pioneer - The pioneer which should make the improvement, if such a Unit has been assigned, and null if nobody has been assigned this mission.

getType

public TileImprovementType getType()
Returns the TileImprovementType of this plan.

Returns:
The type of the improvement.

setType

public void setType(TileImprovementType type)
Sets the type of this TileImprovementPlan.

Parameters:
type - The TileImprovementType.
See Also:
getType()

getTarget

public Tile getTarget()
Gets the target of this TileImprovementPlan.

Returns:
The Tile where pioneer should make the given improvement.

toString

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

getXMLElementTagName

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

Returns:
"TileImprovementPlan"