|
||||||||||
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.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 |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
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. |
Goal |
getGoal()
|
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 . |
void |
setGoal(Goal g)
|
void |
setMission(Mission mission)
Assignes a mission to unit. |
void |
setTransport(AIUnit transport)
Sets the carrier responsible for transporting this Transportable . |
Methods inherited from class net.sf.freecol.server.ai.AIObject |
---|
getAIMain, getGame, isUninitialized, readFromXML |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 Transportable
w
- The Wish
to be aborted.public Locatable getTransportLocatable()
Locatable
which should be transported.
getTransportLocatable
in interface Transportable
Locatable
.public Location getTransportSource()
Transportable
. This is
normally the location of the locatable
.
getTransportSource
in interface Transportable
Transportable
.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 Transportable
Transportable
.public int getTransportPriority()
Transportable
to
it's destination.
getTransportPriority
in interface Transportable
public void increaseTransportPriority()
Transportable
.
This method gets called every turn the Transportable
have
not been put on a carrier's transport list.
increaseTransportPriority
in interface Transportable
public AIUnit getTransport()
Transportable
.
getTransport
in interface Transportable
AIUnit
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 Transportable
transport
- 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 AIObject
public java.lang.String getId()
AIObject
.
getId
in interface Transportable
getId
in class FreeColObject
Unit
this AIObject
controls.public void setGoal(Goal g)
public Goal getGoal()
public static java.lang.String getXMLElementTagName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |