public class MessageCounter<M extends Message> extends Object implements MessageReceiver<M>
Modifier and Type | Class and Description |
---|---|
protected class |
MessageCounter.Counter |
Modifier and Type | Field and Description |
---|---|
protected int |
countCritical |
protected Map<Message.Kind,MessageCounter.Counter> |
counters |
protected int |
criticalMark |
Constructor and Description |
---|
MessageCounter() |
Modifier and Type | Method and Description |
---|---|
protected String |
_toString(boolean filter) |
int |
getCounts(Message.Kind kind)
Returns the count of messages of the given
Message.Kind it has
received since its creation or the last call to resetCounters() |
int |
getCriticalCount()
Returns the count of all critical messages it has
received since its creation or the last call to
resetCounters() . |
int |
getMarkedErros()
Returns the number of new critical errors
occured after the last call to
markCriticalErrors() |
int |
getSum()
Returns the count of all messages it has
received since its creation or the last call to
resetCounters() |
int |
markCriticalErrors()
Stores the number of critical errors for later retrieval by
getMarkedErros() |
String |
nonZeroToString()
Deliver a simple, english based text representation, only mentioning
non-zero counters.
|
void |
receive(M message)
Advance one or two counters, depending on the message's kind.
|
void |
resetCounter(Message.Kind k)
Restart one certain counter with 0(zero), re-adjust critical count
|
void |
resetCounters()
Restart all counting with 0(zero), as if the counter object had just been
created.
|
String |
toString()
Deliver a simple, english based text representation.
|
protected Map<Message.Kind,MessageCounter.Counter> counters
protected int countCritical
protected int criticalMark
public int getCounts(Message.Kind kind)
Message.Kind
it has
received since its creation or the last call to resetCounters()
public int getSum()
resetCounters()
public int markCriticalErrors()
getMarkedErros()
public int getMarkedErros()
markCriticalErrors()
public int getCriticalCount()
resetCounters()
. Message.isCritical()
.public void resetCounter(Message.Kind k)
public void resetCounters()
public void receive(M message)
receive
in interface MessageReceiver<M extends Message>
protected String _toString(boolean filter)
public String toString()
public String nonZeroToString()
see also the complete user documentation .