Class IncrementalSequenceGenerator
- java.lang.Object
-
- com.sportradar.livedata.sdk.common.classes.IncrementalSequenceGenerator
-
- All Implemented Interfaces:
SequenceGenerator
public class IncrementalSequenceGenerator extends Object implements SequenceGenerator
ASequenceGenerator
implementation where each value is obtained by incrementing the previous one.- Author:
- uros.bregar
-
-
Constructor Summary
Constructors Constructor Description IncrementalSequenceGenerator(long minValue, long maxValue)
Initializes a new instance of theIncrementalSequenceGenerator
class.IncrementalSequenceGenerator(long minValue, long maxValue, boolean initialRandomSelected)
Initializes a new instance of theIncrementalSequenceGenerator
class.
-
-
-
Constructor Detail
-
IncrementalSequenceGenerator
public IncrementalSequenceGenerator(long minValue, long maxValue)
Initializes a new instance of theIncrementalSequenceGenerator
class.- Parameters:
minValue
- The min allowed value of the counter.maxValue
- The max allowed value of the counter. When the value is reached the value restarts at minValue.
-
IncrementalSequenceGenerator
public IncrementalSequenceGenerator(long minValue, long maxValue, boolean initialRandomSelected)
Initializes a new instance of theIncrementalSequenceGenerator
class.- Parameters:
minValue
- The min allowed value of the counter.maxValue
- The max allowed value of the counter. When the value is reached the value restarts at minValue.initialRandomSelected
- If true, initial value will be randomly selected between minValue and maxValue
-
-
Method Detail
-
getNext
public long getNext()
Generates and returns next sequence number.- Specified by:
getNext
in interfaceSequenceGenerator
- Returns:
- next sequence number.
-
-