net.sf.freecol.server.ai
Class AIObject

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.server.ai.AIObject
Direct Known Subclasses:
AIColony, AIGoods, AIPlayer, AIUnit, Goal, Mission, ValuedAIObject

public abstract class AIObject
extends FreeColObject

An AIObject contains AI-related information and methods. Each FreeColGameObject, that is owned by an AI-controlled player, can have a single AIObject attached to it.


Field Summary
private  AIMain aiMain
           
private static java.util.logging.Logger logger
           
protected  boolean 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
AIObject(AIMain aiMain)
          Creates a new AIObject.
AIObject(AIMain aiMain, java.lang.String id)
          Creates a new AIObject and registers this object with AIMain.
 
Method Summary
 void dispose()
          Disposes this AIObject by removing any referances to this object.
 AIMain getAIMain()
          Returns the main AI-object.
protected  java.util.Random getAIRandom()
          Gets the random number generator to use in the AI.
 Game getGame()
          Returns the game.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 boolean isUninitialized()
          Checks if this AIObject is uninitialized.
 void readFromXML(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 
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, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readAttributes, readChild, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLImpl, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

aiMain

private final AIMain aiMain

uninitialized

protected boolean uninitialized
Constructor Detail

AIObject

public AIObject(AIMain aiMain)
Creates a new AIObject.

Parameters:
aiMain - The main AI-object.

AIObject

public AIObject(AIMain aiMain,
                java.lang.String id)
Creates a new AIObject and registers this object with AIMain.

Parameters:
aiMain - The main AI-object.
id - The unique identifier.
See Also:
AIMain.addAIObject(String, AIObject)
Method Detail

getAIMain

public AIMain getAIMain()
Returns the main AI-object.

Returns:
The AIMain.

isUninitialized

public boolean isUninitialized()
Checks if this AIObject is uninitialized. That is: it has been referenced by another object, but has not yet been updated with readFromXML(javax.xml.stream.XMLStreamReader).

Returns:
true if this object is not initialized.

getAIRandom

protected java.util.Random getAIRandom()
Gets the random number generator to use in the AI.

Returns:
The AI random number generator.

dispose

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


getGame

public Game getGame()
Returns the game.

Returns:
The Game.

readFromXML

public final void readFromXML(javax.xml.stream.XMLStreamReader in)
                       throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Overrides:
readFromXML in class FreeColObject
Parameters:
in - The input stream containing the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
"AIObject".