net.sf.freecol.server.ai
Class NewAIPlayer

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.NewAIPlayer
Direct Known Subclasses:
EuropeanAIPlayer, IndianAIPlayer

Deprecated. Currently unused, outdated copy of AIPlayer. Eventual specialization of AI should extend AIPlayer, see ColonialAIPlayer. The method startWorking() gets called by the AIInGameInputHandler when it is this player's turn.

public abstract class NewAIPlayer
extends AIObject

Objects of this class contains AI-information for a single Player and is used for controlling this player.


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
NewAIPlayer()
          Deprecated.  
NewAIPlayer(AIMain aiMain, org.w3c.dom.Element element)
          Deprecated. Creates a new AIPlayer and reads the information from the given Element.
NewAIPlayer(AIMain aiMain, ServerPlayer player)
          Deprecated. Creates a new AIPlayer.
NewAIPlayer(AIMain aiMain, javax.xml.stream.XMLStreamReader in)
          Deprecated. Creates a new AIPlayer.
 
Method Summary
 int buyProposition(Unit unit, Goods goods, int gold)
          Deprecated. Called when another Player proposes a trade.
 java.util.Iterator<AIUnit> getAIUnitIterator()
          Deprecated. Returns an iterator over all the AIUnits owned by this player.
 Unit getBestTreasureTrain(Tile tile)
          Deprecated. Returns the treasure train carrying the largest treasure located on the given Tile.
 Connection getConnection()
          Deprecated. Gets the connection to the server.
 java.lang.String getId()
          Deprecated. Returns the ID for this AIPlayer.
 Player getPlayer()
          Deprecated. Returns the Player this AIPlayer is controlling.
static java.lang.String getXMLElementTagName()
          Deprecated. Returns the tag name of the root element representing this object.
 void registerSellGoods(Goods goods)
          Deprecated. Called after another Player sends a trade message
 void setDebuggingConnection(Connection debuggingConnection)
          Deprecated. Sets the Connection to be used while communicating with the server.
abstract  void startWorking()
          Deprecated. Tells this AIPlayer to make decisions.
 
Methods inherited from class net.sf.freecol.server.ai.AIObject
dispose, getAIMain, getGame, 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, 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

NewAIPlayer

public NewAIPlayer()
Deprecated. 

NewAIPlayer

public NewAIPlayer(AIMain aiMain,
                   ServerPlayer player)
Deprecated. 
Creates a new AIPlayer.

Parameters:
aiMain - The main AI-class.
player - The player that should be associated with this AIPlayer.

NewAIPlayer

public NewAIPlayer(AIMain aiMain,
                   org.w3c.dom.Element element)
Deprecated. 
Creates a new AIPlayer and reads the information from the given Element.

Parameters:
aiMain - The main AI-class.
element - The XML-element containing information.

NewAIPlayer

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

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

startWorking

public abstract void startWorking()
Deprecated. 
Tells this AIPlayer to make decisions. The AIPlayer is done doing work this turn when this method returns.


getBestTreasureTrain

public Unit getBestTreasureTrain(Tile tile)
Deprecated. 
Returns the treasure train carrying the largest treasure located on the given Tile.

Parameters:
tile - a Tile value
Returns:
The best treasure train or null if no treasure train is located on this Tile.

getAIUnitIterator

public java.util.Iterator<AIUnit> getAIUnitIterator()
Deprecated. 
Returns an iterator over all the AIUnits owned by this player.

Returns:
The Iterator.

getPlayer

public Player getPlayer()
Deprecated. 
Returns the Player this AIPlayer is controlling.

Returns:
The Player.

getConnection

public Connection getConnection()
Deprecated. 
Gets the connection to the server.

Returns:
The connection that can be used when communication with the server.

setDebuggingConnection

public void setDebuggingConnection(Connection debuggingConnection)
Deprecated. 
Sets the Connection to be used while communicating with the server. This method is only used for debugging.

Parameters:
debuggingConnection - The connection to be used for debugging.

getId

public java.lang.String getId()
Deprecated. 
Returns the ID for this AIPlayer. This is the same as the ID for the Player this AIPlayer controls.

Overrides:
getId in class FreeColObject
Returns:
The ID.

getXMLElementTagName

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

Returns:
the tag name.

registerSellGoods

public void registerSellGoods(Goods goods)
Deprecated. 
Called after another Player sends a trade message

Parameters:
goods - The goods which we are going to offer

buyProposition

public int buyProposition(Unit unit,
                          Goods goods,
                          int gold)
Deprecated. 
Called when another Player proposes a trade.

Parameters:
unit - The foreign Unit trying to trade.
goods - The goods the given Unit is trying to sell.
gold - The suggested price.
Returns:
The price this AIPlayer suggests or NetworkConstants.NO_TRADE.