|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.server.ai.AIObject
net.sf.freecol.server.ai.ValuedAIObject
net.sf.freecol.server.ai.TileImprovementPlan
public class TileImprovementPlan
Represents a Tile which should be improved in some way.
For instance by plowing or by building a road.
Tile| Field Summary | |
|---|---|
private static java.util.logging.Logger |
logger
|
private AIUnit |
pioneer
The pioneer which should make the improvement (if a Unit has
been assigned). |
private Tile |
target
The Tile to be improved. |
private TileImprovementType |
type
The type of improvement, from TileImprovementTypes. |
| 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 | |
|---|---|
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. |
static TileImprovementType |
getBestTileImprovementType(Tile tile,
GoodsType goodsType)
Gets the 'most effective' TileImprovementType allowed for a given tile and goods type. |
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. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Reads information for this object from an XML stream. |
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()
|
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Writes this object to an XML stream. |
boolean |
update(GoodsType goodsType)
Updates this tile improvement plan to the best available for its tile and the specified goods type. |
| 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, getSpecification, isUninitialized, readFromXML |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private TileImprovementType type
private AIUnit pioneer
Unit has
been assigned).
private Tile target
Tile to be improved.
| Constructor Detail |
|---|
public TileImprovementPlan(AIMain aiMain,
Tile target,
TileImprovementType type,
int value)
TileImprovementPlan.
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.
public TileImprovementPlan(AIMain aiMain,
org.w3c.dom.Element element)
TileImprovementPlan from the given
XML-representation.
aiMain - The main AI-object.element - The root element for the XML-representation
of a Wish.
public TileImprovementPlan(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
TileImprovementPlan from the given
XML-representation.
aiMain - The main AI-object.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.
public TileImprovementPlan(AIMain aiMain,
java.lang.String id)
throws javax.xml.stream.XMLStreamException
TileImprovementPlan from the given XML-representation.
aiMain - The main AI-object.id - The ID.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.| Method Detail |
|---|
public void dispose()
TileImprovementPlan.
If a pioneer has been assigned to making this improvement,
then this pioneer gets informed that the improvement is
no longer wanted.
dispose in class AIObjectpublic AIUnit getPioneer()
AIUnit has been assigned, and
null if nobody has been assigned this
mission.public void setPioneer(AIUnit pioneer)
pioneer - The pioneer which should make the improvement, if
such a Unit has been assigned, and
null if nobody has been assigned this
mission.public TileImprovementType getType()
TileImprovementType of this plan.
public void setType(TileImprovementType type)
TileImprovementPlan.
type - The TileImprovementType.getType()public Tile getTarget()
TileImprovementPlan.
Tile where
pioneer should make the
given improvement.
public static TileImprovementType getBestTileImprovementType(Tile tile,
GoodsType goodsType)
tile - The Tile that will be improved.goodsType - The GoodsType to be prioritized.
public boolean update(GoodsType goodsType)
goodsType - The GoodsType to be prioritized.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if there are any problems reading
from the stream.public java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||