net.sf.freecol.server.ai
Class GoodsWish

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
                  extended by net.sf.freecol.server.ai.GoodsWish
All Implemented Interfaces:
java.lang.Comparable<ValuedAIObject>

public class GoodsWish
extends Wish

Represents the need for goods within a Colony.


Field Summary
private  int amountRequested
           
private  GoodsType goodsType
           
private static java.util.logging.Logger logger
           
 
Fields inherited from class net.sf.freecol.server.ai.Wish
destination, transportable
 
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
GoodsWish(AIMain aiMain, org.w3c.dom.Element element)
          Creates a new GoodsWish from the given XML-representation.
GoodsWish(AIMain aiMain, Location destination, int value, GoodsType goodsType)
          Creates a new GoodsWish, using a standard request amount of 100.
GoodsWish(AIMain aiMain, Location destination, int value, int amountRequested, GoodsType goodsType)
          Creates a new GoodsWish.
GoodsWish(AIMain aiMain, java.lang.String id)
          Creates a new GoodsWish.
GoodsWish(AIMain aiMain, javax.xml.stream.XMLStreamReader in)
          Creates a new GoodsWish.
 
Method Summary
 int getGoodsAmount()
          Describe getGoodsAmount method here.
 GoodsType getGoodsType()
          Describe getGoodsType method here.
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.
 java.lang.String toString()
           
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          Writes this object to an XML stream.
 
Methods inherited from class net.sf.freecol.server.ai.Wish
attachToDestination, dispose, getDestination, getDestinationAIColony, getTransportable, setTransportable, shouldBeStored
 
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 net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readAttributes, readAttributes, readChild, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

goodsType

private GoodsType goodsType

amountRequested

private int amountRequested
Constructor Detail

GoodsWish

public GoodsWish(AIMain aiMain,
                 Location destination,
                 int value,
                 int amountRequested,
                 GoodsType goodsType)
Creates a new GoodsWish.

Parameters:
aiMain - The main AI-object.
destination - The Location in which the transportable assigned to this GoodsWish will have to reach.
value - The value identifying the importance of this Wish.
amountRequested - The amount requested.
goodsType - The type of goods needed for releasing this wish completly.

GoodsWish

public GoodsWish(AIMain aiMain,
                 Location destination,
                 int value,
                 GoodsType goodsType)
Creates a new GoodsWish, using a standard request amount of 100. Possible TODO: Deprecate this in favor of the constructor without std amount?

Parameters:
aiMain - The main AI-object.
destination - The Location in which the transportable assigned to this GoodsWish will have to reach.
value - The value identifying the importance of this Wish.
goodsType - The type of goods needed for releasing this wish completly.

GoodsWish

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

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

GoodsWish

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

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

GoodsWish

public GoodsWish(AIMain aiMain,
                 javax.xml.stream.XMLStreamReader in)
          throws javax.xml.stream.XMLStreamException
Creates a new GoodsWish.

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

getGoodsType

public GoodsType getGoodsType()
Describe getGoodsType method here.

Returns:
a GoodsType value

getGoodsAmount

public int getGoodsAmount()
Describe getGoodsAmount method here.

Returns:
an int value

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
Writes this object to an XML stream.

Specified by:
toXMLImpl in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Reads information for this object from an XML stream.

Overrides:
readFromXMLImpl in class FreeColObject
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems reading from the stream.

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:
"goodsWish"