net.sf.freecol.server.ai
Class AIInGameInputHandler

java.lang.Object
  extended by net.sf.freecol.server.ai.AIInGameInputHandler
All Implemented Interfaces:
MessageHandler, StreamedMessageHandler

public final class AIInGameInputHandler
extends java.lang.Object
implements MessageHandler, StreamedMessageHandler

Handles the network messages that arrives while in the game.


Constructor Summary
AIInGameInputHandler(FreeColServer freeColServer, ServerPlayer me, AIMain aiMain)
          The constructor to use.
 
Method Summary
 boolean accepts(java.lang.String tagName)
          Checks if the message handler support the given message.
 AIPlayer getAIPlayer()
          Gets the AIPlayer using this AIInGameInputHandler.
 org.w3c.dom.Element handle(Connection connection, org.w3c.dom.Element element)
          Deals with incoming messages that have just been received.
 void handle(Connection connection, javax.xml.stream.XMLStreamReader in, javax.xml.stream.XMLStreamWriter out)
          Handles the main element of an XML message.
 org.w3c.dom.Element multiple(Connection connection, org.w3c.dom.Element element)
          Handle all the children of this element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AIInGameInputHandler

public AIInGameInputHandler(FreeColServer freeColServer,
                            ServerPlayer me,
                            AIMain aiMain)
The constructor to use.

Parameters:
freeColServer - The main server.
me - The AI player that is being managed by this AIInGameInputHandler.
aiMain - The main AI-object.
Method Detail

handle

public org.w3c.dom.Element handle(Connection connection,
                                  org.w3c.dom.Element element)
Deals with incoming messages that have just been received.

Specified by:
handle in interface MessageHandler
Parameters:
connection - The Connection the message was received on.
element - The root element of the message.
Returns:
The reply.

handle

public void handle(Connection connection,
                   javax.xml.stream.XMLStreamReader in,
                   javax.xml.stream.XMLStreamWriter out)
Handles the main element of an XML message.

Specified by:
handle in interface StreamedMessageHandler
Parameters:
connection - The connection the message came from.
in - The stream containing the message.
out - The output stream for the reply.

accepts

public boolean accepts(java.lang.String tagName)
Checks if the message handler support the given message.

Specified by:
accepts in interface StreamedMessageHandler
Parameters:
tagName - The tag name of the message to check.
Returns:
The result (currently always false).

multiple

public org.w3c.dom.Element multiple(Connection connection,
                                    org.w3c.dom.Element element)
Handle all the children of this element.

Parameters:
element - The element (root element in a DOM-parsed XML tree) that holds all the information.

getAIPlayer

public AIPlayer getAIPlayer()
Gets the AIPlayer using this AIInGameInputHandler.

Returns:
The AIPlayer.