Class MessageList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable

    public class MessageList
    extends java.lang.Object
    implements java.lang.Iterable, java.io.Serializable
    This is the list of the recorded messages. This class provides methods to notify other classes which are implementing the IMessageListListener interface about adding, changing and removing messages.
    See Also:
    Serialized Form
    • Field Detail

      • elements

        protected java.util.List elements
        The list of messages
      • listeners

        protected java.util.List listeners
        The listener for message events.
    • Constructor Detail

      • MessageList

        public MessageList()
        Default constructor for the message list.
    • Method Detail

      • addMessage

        public void addMessage​(Message msg)
        Adds a message to the list.
        Parameters:
        msg - The message to add.
      • addMessages

        public void addMessages​(Message[] messages)
        Parameters:
        messages - The array of messages to add.
      • removeMessage

        public void removeMessage​(Message msg)
        Parameters:
        msg - The message to remove
      • removeMessages

        public void removeMessages​(Message[] messages)
        Parameters:
        messages - The array of messages to remove.
      • removeAllMessages

        public void removeAllMessages()
        Clear all messages in the list.
      • containsMessage

        public boolean containsMessage​(Message message)
        Checks if a message is contained in the message list.
        Parameters:
        message - The message to check.
        Returns:
        true if a specific message is in the agentlist.
      • getMessages

        public Message[] getMessages()
        Returns:
        The array of messages.
      • getList

        public java.util.List getList()
        Returns:
        The list of agents
      • size

        public int size()
        Returns:
        The size of the message list.
      • iterator

        public java.util.Iterator iterator()
        Specified by:
        iterator in interface java.lang.Iterable
        Returns:
        The message list iterator.
      • addListener

        protected void addListener​(IMessageListListener ml)
        Register for message events.
        Parameters:
        listener - A class implementing the IMessageListListener interface.
      • fireMessagesAdded

        protected void fireMessagesAdded​(Message[] messages)
        Notifies the listeners about the adding of messages.
        Parameters:
        messages - The added messages.
      • fireMessagesRemoved

        protected void fireMessagesRemoved​(Message[] messages)
        Notifies the listeners about the removel of messages.
        Parameters:
        messages - The removed messages.
      • fireMessagesChanged

        protected void fireMessagesChanged​(Message[] messages)
        Notifies the listeners about messages with changed visibility.
        Parameters:
        messages - The changed messages.