Class MultipleMessage


  • public class MultipleMessage
    extends AttributeMessage
    The message that contains other messages.
    • Field Detail

      • messages

        private final java.util.List<Message> messages
        The list of messages.
    • Constructor Detail

      • MultipleMessage

        public MultipleMessage()
        Create a new MultipleMessage.
      • MultipleMessage

        public MultipleMessage​(java.util.List<Message> messages)
        Create a new MultipleMessage with the given messages.
        Parameters:
        messages - The Messages to add.
      • MultipleMessage

        public MultipleMessage​(Game game,
                               FreeColXMLReader xr)
                        throws javax.xml.stream.XMLStreamException,
                               FreeColException
        Create a new MultipleMessage from a stream.
        Parameters:
        game - The Game to read within.
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if the stream is corrupt.
        FreeColException - if the internal message can not be read.
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Is this message vacuous?
        Overrides:
        isEmpty in class Message
        Returns:
        True if there are no attributes or children present.
      • aiHandler

        public void aiHandler​(FreeColServer freeColServer,
                              AIPlayer aiPlayer)
                       throws FreeColException
        AI-side handler for this message. AI handlers always return null. FIXME: One day the FreeColServer should devolve to AIMain.
        Overrides:
        aiHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        aiPlayer - The AIPlayer the message was sent to.
        Throws:
        FreeColException - if there is a problem handling the message.
      • clientHandler

        public void clientHandler​(FreeColClient freeColClient)
                           throws FreeColException
        Client-side handler for this message. Client handlers always return null.
        Overrides:
        clientHandler in class TrivialMessage
        Parameters:
        freeColClient - The FreeColClient to handle this message.
        Throws:
        FreeColException - if there is a problem building the message.
      • serverHandler

        public ChangeSet serverHandler​(FreeColServer freeColServer,
                                       ServerPlayer serverPlayer)
        Server-side handler for this message.
        Overrides:
        serverHandler in class TrivialMessage
        Parameters:
        freeColServer - The FreeColServer handling the request.
        serverPlayer - The ServerPlayer that sent the request.
        Returns:
        A ChangeSet defining the response.
      • writeChildren

        public void writeChildren​(FreeColXMLWriter xw)
                           throws javax.xml.stream.XMLStreamException
        Write any children of this message.
        Overrides:
        writeChildren in class Message
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem writing the stream.
      • simplify

        public Message simplify()
        Simplify this message. Called from ChangeSet.build with the intent of minimizing traffic.
        Returns:
        A simplified Message.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Message