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_Messages
the collected messages.
-
Constructor Summary
Constructors Constructor Description MessageCollection()
Initializes the container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, String msg)
Adds the message at the specified index.void
add(int index, String msg, Throwable t)
Adds the message at the specified index.void
add(String msg)
Adds the message.void
add(String msg, Throwable t)
Adds the message.void
addAll(MessageCollection msgs)
Adds all the messages.void
addAll(Collection<String> msgs)
Adds all the messages.void
clear()
Clears all messages.String
get(int index)
Returns the message at the specified index.boolean
isEmpty()
Checks whether any messages were collected.String
remove(int index)
Deletes the message at the specified index.int
size()
Returns the number of messages collected.List<String>
toList()
Returns the collected messages as list.String
toString()
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.
-
-