com.metamatrix.api.core.message
Class MessageList.Statistics

java.lang.Object
  extended by com.metamatrix.api.core.message.MessageList.Statistics
Enclosing class:
MessageList

public class MessageList.Statistics
extends java.lang.Object

Class that maintains statistics for the MessageList's Message instances categorized by various types. Instances of this class are automatically created by MessageList and dynamically reflect any changes to its MessageList.


Constructor Summary
protected MessageList.Statistics()
          No-arg constructor
 
Method Summary
protected  void addMessage(Message msg)
          Add a message to the statistics.
protected  void clear()
          Clear the current statistics
 int getErrorCount()
          Gets the number of Message instances that have a type of MessageTypes.ERROR_MESSAGE.
 int getNoneCount()
          Gets the number of Message instances that have a type of MessageTypes.NULL_MESSAGE (e.g., no type specified).
 int getNotificationCount()
          Gets the number of Message instances that have a type of MessageTypes.NOTIFICATION_MESSAGE.
 int getOtherCount()
          Gets the number of Message instances that have a type other than MessageTypes.ERROR_MESSAGE, MessageTypes.WARNING_MESSAGE, MessageTypes.NOTIFICATION_MESSAGE, or MessageTypes.NULL_MESSAGE.
 int getTotalCount()
          Gets the total number of Message instances in the backing MessageList instance.
 int getWarningCount()
          Gets the number of Message instances that have a type of MessageTypes.WARNING_MESSAGE.
protected  void removeMessage(Message msg)
          Remove a message from the statistics.
 java.lang.String toString()
          Return the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageList.Statistics

protected MessageList.Statistics()
No-arg constructor

Method Detail

clear

protected void clear()
Clear the current statistics


addMessage

protected void addMessage(Message msg)
Add a message to the statistics.

Parameters:
msg - the Message to be added; if null, this method does nothing

removeMessage

protected void removeMessage(Message msg)
Remove a message from the statistics.

Parameters:
msg - the Message to be removed; if null, this method does nothing

getErrorCount

public int getErrorCount()
Gets the number of Message instances that have a type of MessageTypes.ERROR_MESSAGE.

Note that this value may change as Message instances are added to and removed from this Statistic's backing MessageList.

Returns:
Returns a the number of error Message instances.

getWarningCount

public int getWarningCount()
Gets the number of Message instances that have a type of MessageTypes.WARNING_MESSAGE.

Note that this value may change as Message instances are added to and removed from this Statistic's backing MessageList.

Returns:
Returns a the number of warning Message instances.

getNotificationCount

public int getNotificationCount()
Gets the number of Message instances that have a type of MessageTypes.NOTIFICATION_MESSAGE.

Note that this value may change as Message instances are added to and removed from this Statistic's backing MessageList.

Returns:
Returns a the number of notification Message instances.

getNoneCount

public int getNoneCount()
Gets the number of Message instances that have a type of MessageTypes.NULL_MESSAGE (e.g., no type specified).

Note that this value may change as Message instances are added to and removed from this Statistic's backing MessageList.

Returns:
Returns a the number of Message instances that have no type specified.

getOtherCount

public int getOtherCount()
Gets the number of Message instances that have a type other than MessageTypes.ERROR_MESSAGE, MessageTypes.WARNING_MESSAGE, MessageTypes.NOTIFICATION_MESSAGE, or MessageTypes.NULL_MESSAGE.

Note that this value may change as Message instances are added to and removed from this Statistic's backing MessageList.

Returns:
Returns a the number of Message instances that are not errors, warnings, notifications or that have no types.

getTotalCount

public int getTotalCount()
Gets the total number of Message instances in the backing MessageList instance. This method returns exactly the same value as MessageList.size().

Note that this value may change as Message instances are added to and removed from this Statistic's backing MessageList.

Returns:
Returns a the total number of error Message instances.

toString

public java.lang.String toString()
Return the string representation of this object. This method returns a string of the form:

[ne] errors, [nw] warnings, [nn] notifications, [nt] no-type, [no] others, [sum] total

where

Overrides:
toString in class java.lang.Object
Returns:
the string representation


Copyright © 2009. All Rights Reserved.