net.eduvax.util
public class EventCounter<T> extends java.lang.Object implements Handler<T>, Observable<EventCounter<T>>
Modifier and Type | Class and Description |
---|---|
static class |
EventCounter.EOpCode
Operation code applicable to the status counter
|
Modifier and Type | Field and Description |
---|---|
private java.util.Hashtable<java.lang.String,java.util.regex.Pattern> |
_masks
Matching rules
|
private int |
_max
max value for the status counter
|
private int |
_min
min value for the status counter
|
private ObserverManager<EventCounter<T>> |
_obsManager |
private java.util.Hashtable<java.util.regex.Pattern,EventCounter.EOpCode> |
_opCodes
Matching rules to opcode links.
|
private int |
_value
status counter value
|
Constructor and Description |
---|
EventCounter() |
Modifier and Type | Method and Description |
---|---|
void |
addMasks(java.lang.String regexStr,
EventCounter.EOpCode opCode)
Add matching pattern linked to an operation on counter.
|
ObserverManager<EventCounter<T>> |
getObserverManager()
Get this observable observer registration manager.
|
int |
getValue()
get current value of the status counter.
|
void |
handle(T toHandle)
handling one object
|
void |
resetMasks()
Remove all matching rules.
|
void |
setMax(int m)
Set max value for status counter.
|
void |
setMin(int m)
Set min value for the status counter.
|
private int _value
private int _min
private int _max
private ObserverManager<EventCounter<T>> _obsManager
private java.util.Hashtable<java.lang.String,java.util.regex.Pattern> _masks
private java.util.Hashtable<java.util.regex.Pattern,EventCounter.EOpCode> _opCodes
public void addMasks(java.lang.String regexStr, EventCounter.EOpCode opCode) throws java.util.regex.PatternSyntaxException
regexStr
- regular expression defining the matching rule.opCode
- operation link to the matching rule.java.util.regex.PatternSyntaxException
public void resetMasks()
public void handle(T toHandle)
Handler
public int getValue()
public void setMin(int m)
m
- new min valuepublic void setMax(int m)
m
- new max valuepublic ObserverManager<EventCounter<T>> getObserverManager()
Observable
getObserverManager
in interface Observable<EventCounter<T>>