Package adams.core
Class MessageCollection
- java.lang.Object
-
- adams.core.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 Summary
Fields Modifier and Type Field Description protected List<String>m_Messagesthe collected messages.
-
Constructor Summary
Constructors Constructor Description MessageCollection()Initializes the container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, String msg)Adds the message at the specified index.voidadd(int index, String msg, Throwable t)Adds the message at the specified index.voidadd(String msg)Adds the message.voidadd(String msg, Throwable t)Adds the message.voidaddAll(MessageCollection msgs)Adds all the messages.voidaddAll(Collection<String> msgs)Adds all the messages.voidclear()Clears all messages.Stringget(int index)Returns the message at the specified index.booleanisEmpty()Checks whether any messages were collected.Stringremove(int index)Deletes the message at the specified index.intsize()Returns the number of messages collected.List<String>toList()Returns the collected messages as list.StringtoString()Returns the messages collated as single string.
-
-
-
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 collectt- 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 messagemsg- 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 messagemsg- the message to collectt- 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.
-
-