Package adams.core

Class MessageCollection

  • All Implemented Interfaces:
    Serializable

    public class MessageCollection
    extends Object
    implements Serializable
    Container for collecting messages.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Messages

        protected List<String> m_Messages
        the collected messages.
    • Constructor Detail

      • MessageCollection

        public MessageCollection()
        Initializes the container.
    • Method Detail

      • clear

        public void clear()
        Clears all messages.
      • isEmpty

        public boolean isEmpty()
        Checks whether any messages were collected.
        Returns:
        true if at least one message collected
      • size

        public int size()
        Returns the number of messages collected.
        Returns:
        the number of messages
      • add

        public void add​(String msg)
        Adds the message.
        Parameters:
        msg - the message to collect
      • add

        public void add​(String msg,
                        Throwable t)
        Adds the message.
        Parameters:
        msg - the message to collect
        t - the associated exception
      • add

        public void add​(int index,
                        String msg)
        Adds the message at the specified index.
        Parameters:
        index - the index where to insert the message
        msg - the message to collect
      • add

        public void add​(int index,
                        String msg,
                        Throwable t)
        Adds the message at the specified index.
        Parameters:
        index - the index where to insert the message
        msg - the message to collect
        t - the associated execption
      • addAll

        public void addAll​(Collection<String> msgs)
        Adds all the messages.
        Parameters:
        msgs - the messages to add
      • addAll

        public void addAll​(MessageCollection msgs)
        Adds all the messages.
        Parameters:
        msgs - the messages to add
      • get

        public String get​(int index)
        Returns the message at the specified index.
        Parameters:
        index - the index of the message to retrieve
        Returns:
        the message at the index
      • remove

        public String remove​(int index)
        Deletes the message at the specified index.
        Parameters:
        index - the index of the message to delete
        Returns:
        the removed message
      • toString

        public String toString()
        Returns the messages collated as single string.
        Overrides:
        toString in class Object
        Returns:
        the collected messages
      • toList

        public List<String> toList()
        Returns the collected messages as list.
        Returns:
        the collected messages