Public Types | |
enum | Logic { AND, OR, TIMER, COUNTER } |
Public Member Functions | |
RepeatGuard (long interval, TimeUnit timeUnit, int maxRepetitions, Logic logic) | |
RepeatGuard (long interval, TimeUnit timeUnit, int maxRepetitions) | |
synchronized boolean | check () |
synchronized boolean | checkAndIncrement () |
void | reset (long interval, TimeUnit timeUnit, int maxRepetitions) |
synchronized void | reset (long interval, TimeUnit timeUnit, int maxRepetitions, Logic logic) |
synchronized void | reset () |
synchronized void | increment () |
synchronized int | counter () |
synchronized int | count () |
Package Types | |
Private Attributes | |
Logic | evaluationMethod |
int | maxRepetitions |
long | endTimeNs |
long | intervalNs |
int | counter |
int | counterAtLastCheck |
boolean | firstTime |
|
|
|
Constructor.
|
|
Constructor, convenience for the above, using OR evaluation method.
|
|
Check returns true, if the last call for check was longer ago than interval and/or increment has been called more than maxRepetitions.
|
|
Increments and checks (see check()).
|
|
Get count at last check.
|
|
Get current counter value.
|
|
Increase couter value. |
|
Reset and reconfigure logic of guard. |
|
Reset and reconfigure logic of guard.
|
|
Reset and reconfigure logic of guard using OR logic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|