@FunctionalInterface public interface ElapsedTimeStrategy
| Modifier and Type | Method and Description |
|---|---|
static ElapsedTimeStrategy |
constant(Clock clock,
long delayInMilliseconds)
Create a strategy whose time periods are constant.
|
static ElapsedTimeStrategy |
exponential(Clock clock,
long initialDelayInMilliseconds,
long maxDelayInMilliseconds)
Create a strategy whose time periods increase exponentially.
|
static ElapsedTimeStrategy |
exponential(Clock clock,
long initialDelayInMilliseconds,
long maxDelayInMilliseconds,
double multiplier)
Create a strategy whose time periods increase exponentially.
|
boolean |
hasElapsed()
Determine if the time period has elapsed since this method was last called.
|
static ElapsedTimeStrategy |
linear(Clock clock,
long delayInMilliseconds)
Create a strategy whose time periods linearly increase in length.
|
static ElapsedTimeStrategy |
none()
Create an elapsed time strategy that always is elapsed.
|
static ElapsedTimeStrategy |
step(Clock clock,
long preStepDelayInMilliseconds,
BooleanSupplier stepFunction,
long postStepDelayInMilliseconds)
Create a strategy whose time periods start out at one length but then change to another length after another
period has elapsed.
|
boolean hasElapsed()
true if this invocation caused the thread to sleep, or false if this method did not sleepstatic ElapsedTimeStrategy none()
static ElapsedTimeStrategy constant(Clock clock, long delayInMilliseconds)
clock - the clock used to determine if sufficient time has elapsed; may not be nulldelayInMilliseconds - the time period; must be positivestatic ElapsedTimeStrategy step(Clock clock, long preStepDelayInMilliseconds, BooleanSupplier stepFunction, long postStepDelayInMilliseconds)
clock - the clock used to determine if sufficient time has elapsed; may not be nullpreStepDelayInMilliseconds - the time period before the step has occurred; must be positivestepFunction - the function that determines if the step time has elapsed; may not be nullpostStepDelayInMilliseconds - the time period before the step has occurred; must be positivestatic ElapsedTimeStrategy linear(Clock clock, long delayInMilliseconds)
clock - the clock used to determine if sufficient time has elapsed; may not be nulldelayInMilliseconds - the initial delay; must be positivestatic ElapsedTimeStrategy exponential(Clock clock, long initialDelayInMilliseconds, long maxDelayInMilliseconds)
clock - the clock used to determine if sufficient time has elapsed; may not be nullinitialDelayInMilliseconds - the initial delay; must be positivemaxDelayInMilliseconds - the maximum delay; must be greater than the initial delaystatic ElapsedTimeStrategy exponential(Clock clock, long initialDelayInMilliseconds, long maxDelayInMilliseconds, double multiplier)
clock - the clock used to determine if sufficient time has elapsed; may not be nullinitialDelayInMilliseconds - the initial delay; must be positivemaxDelayInMilliseconds - the maximum delay; must be greater than the initial delaymultiplier - the factor by which the delay increases each passCopyright © 2018 JBoss by Red Hat. All rights reserved.