net.sf.freecol.server.ai
Class Wish

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
All Implemented Interfaces:
java.lang.Comparable<ValuedAIObject>
Direct Known Subclasses:
GoodsWish, WorkerWish

public abstract class Wish
extends ValuedAIObject

Represents a need for something at a given Location.


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
Wish(AIMain aiMain, org.w3c.dom.Element element)
          Creates a new Wish from the given XML-representation.
Wish(AIMain aiMain, java.lang.String id)
          Creates a new Wish.
Wish(AIMain aiMain, javax.xml.stream.XMLStreamReader in)
          Creates a new Wish from the given XML-representation.
 
Method Summary
 void dispose()
          Disposes this AIObject by removing any referances to this object.
 Location getDestination()
          Gets the destination of this Wish.
 Transportable getTransportable()
          Gets the Transportable assigned to this Wish.
 void setTransportable(Transportable transportable)
          Assigns a Transportable to this Wish.
 boolean shouldBeStored()
          Checks if this Wish needs to be stored in a savegame.
 
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, getXMLElementTagName, 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, toString, wait, wait, wait
 

Constructor Detail

Wish

public Wish(AIMain aiMain,
            java.lang.String id)
Creates a new Wish.

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

Wish

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

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

Wish

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

shouldBeStored

public boolean shouldBeStored()
Checks if this Wish needs to be stored in a savegame.

Returns:
The result.

setTransportable

public void setTransportable(Transportable transportable)
Assigns a Transportable to this Wish.

Parameters:
transportable - The Transportable which should realize this wish.
See Also:
getTransportable(), WishRealizationMission

getTransportable

public Transportable getTransportable()
Gets the Transportable assigned to this Wish.

Returns:
The Transportable which will realize this wish, or null if none has been assigned.
See Also:
setTransportable(net.sf.freecol.server.ai.Transportable), WishRealizationMission

dispose

public void dispose()
Disposes this AIObject by removing any referances to this object.

Overrides:
dispose in class AIObject

getDestination

public Location getDestination()
Gets the destination of this Wish.

Returns:
The Location in which the transportable assigned to this Wish will have to reach.