|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.ai.AIObject
net.sf.freecol.server.ai.AIUnit
public class AIUnit
Objects of this class contains AI-information for a single Unit.
The method doMission(Connection) is called once each turn, by
AIPlayer.startWorking(), to perform the assigned
Mission. Most of the methods in this class just delegates the
call to that mission.
Mission| Field Summary | |
|---|---|
static java.lang.String |
COPYRIGHT
|
static java.lang.String |
LICENSE
|
static java.lang.String |
REVISION
|
| Fields inherited from class net.sf.freecol.server.ai.AIObject |
|---|
id, uninitialized |
| Constructor Summary | |
|---|---|
AIUnit(AIMain aiMain,
org.w3c.dom.Element element)
Creates a new AIUnit. |
|
AIUnit(AIMain aiMain,
java.lang.String id)
Creates a new AIUnit. |
|
AIUnit(AIMain aiMain,
Unit unit)
Creates a new AIUnit. |
|
AIUnit(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
Creates a new AIUnit. |
|
| Method Summary | |
|---|---|
void |
abortWish(Wish w)
Aborts the given Wish. |
void |
dispose()
Disposes this object and any attached mission. |
void |
doMission(Connection connection)
Performs the mission this unit has been assigned. |
java.lang.String |
getID()
Returns the ID of this AIObject. |
Mission |
getMission()
Gets the mission this unit has been assigned. |
AIUnit |
getTransport()
Gets the carrier responsible for transporting this Transportable. |
Location |
getTransportDestination()
Returns the destination for this Transportable. |
Locatable |
getTransportLocatable()
Gets the Locatable which should be transported. |
int |
getTransportPriority()
Gets the priority of transporting this Transportable to
it's destination. |
Location |
getTransportSource()
Returns the source for this Transportable. |
Unit |
getUnit()
Gets the Unit this AIUnit controls. |
static java.lang.String |
getXMLElementTagName()
Returns the tag name of the root element representing this object. |
boolean |
hasMission()
Checks if this unit has been assigned a mission. |
void |
increaseTransportPriority()
Increases the transport priority of this Transportable. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Reads information for this object from an XML stream. |
void |
setMission(Mission mission)
Assignes a mission to unit. |
void |
setTransport(AIUnit transport)
Sets the carrier responsible for transporting this Transportable. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
Writes this object to an XML stream. |
| Methods inherited from class net.sf.freecol.server.ai.AIObject |
|---|
getAIMain, getGame, getRandom, isUninitialized, readFromXML, readFromXMLElement, toXML, toXMLElement |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String COPYRIGHT
public static final java.lang.String LICENSE
public static final java.lang.String REVISION
| Constructor Detail |
|---|
public AIUnit(AIMain aiMain,
Unit unit)
AIUnit.
aiMain - The main AI-object.unit - The unit to make an AIObject for.
public AIUnit(AIMain aiMain,
org.w3c.dom.Element element)
AIUnit.
aiMain - The main AI-object.element - An Element containing an XML-representation
of this object.
public AIUnit(AIMain aiMain,
javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
AIUnit.
aiMain - The main AI-object.in - The input stream containing the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.AIObject.readFromXML(javax.xml.stream.XMLStreamReader)
public AIUnit(AIMain aiMain,
java.lang.String id)
AIUnit.
aiMain - The main AI-object.id - The unique ID of this object.| Method Detail |
|---|
public Unit getUnit()
Unit this AIUnit controls.
Unit.public void abortWish(Wish w)
Wish.
abortWish in interface Transportablew - The Wish to be aborted.public Locatable getTransportLocatable()
Locatable which should be transported.
getTransportLocatable in interface TransportableLocatable.public Location getTransportSource()
Transportable. This is
normally the location of the locatable.
getTransportSource in interface TransportableTransportable.public Location getTransportDestination()
Transportable. This can
either be the target Tile of the transport or the target for the
entire Transportable's mission. The target for the
tansport is determined by TransportMission in the latter case.
getTransportDestination in interface TransportableTransportable.public int getTransportPriority()
Transportable to
it's destination.
getTransportPriority in interface Transportablepublic void increaseTransportPriority()
Transportable.
This method gets called every turn the Transportable have
not been put on a carrier's transport list.
increaseTransportPriority in interface Transportablepublic AIUnit getTransport()
Transportable.
getTransport in interface TransportableAIUnit which has this
Transportable in it's transport list. This
Transportable has not been scheduled for transport
if this value is null.public void setTransport(AIUnit transport)
Transportable.
setTransport in interface Transportabletransport - The AIUnit which has this
Transportable in it's transport list. This
Transportable has not been scheduled for
transport if this value is null.public Mission getMission()
Mission.public boolean hasMission()
true if this unit has a mission.public void setMission(Mission mission)
mission - The new Mission.public void doMission(Connection connection)
connection - The Connection to use when communicating
with the server.public void dispose()
dispose in class AIObjectpublic java.lang.String getID()
AIObject.
getID in interface TransportablegetID in class AIObjectUnit this AIObject
controls.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class AIObjectout - 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 AIObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if there are any problems reading from the
stream.public static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||