public abstract class WindowIndexedArrays extends Object
Modifier and Type | Field and Description |
---|---|
static int |
INVALID_INDEX |
protected long |
oldestWindowIndex |
Constructor and Description |
---|
WindowIndexedArrays() |
Modifier and Type | Method and Description |
---|---|
protected int |
arrayIndex(long windowIndex)
Get the array index of the given window index.
|
protected long |
currentWindowIndex() |
protected int |
firstArrayIndex()
Get the first array index in the circular array.
|
protected boolean |
inValidWindowRange(long windowIndex)
Check if a given window index is valid or not.
|
protected int |
lastArrayIndex() |
protected long |
lastWindowIndex() |
protected abstract int |
length() |
protected int |
nextArrayIndex(int arrayIndex)
The next array index of a given array index.
|
protected int |
prevArrayIndex(int arrayIndex)
The previous array index of a given array index.
|
void |
updateOldestWindowIndex(long newOldestWindowIndex)
Update the oldest window index.
|
protected void |
validateWindowIndex(long windowIndex)
Check if a given window index is valid or not.
|
public static final int INVALID_INDEX
protected volatile long oldestWindowIndex
public void updateOldestWindowIndex(long newOldestWindowIndex)
newOldestWindowIndex
- the new oldest window index.protected abstract int length()
protected void validateWindowIndex(long windowIndex)
windowIndex
- the window index to check.protected int prevArrayIndex(int arrayIndex)
arrayIndex
- the array index to get the previous array index for.INVALID_INDEX
otherwise.protected int nextArrayIndex(int arrayIndex)
arrayIndex
- the array index to get the next array index for.INVALID_INDEX
otherwise.protected int firstArrayIndex()
protected int lastArrayIndex()
lastWindowIndex()
.protected long lastWindowIndex()
currentWindowIndex()
- 1.protected boolean inValidWindowRange(long windowIndex)
windowIndex
- the window index to check.protected long currentWindowIndex()
protected int arrayIndex(long windowIndex)
windowIndex
- the window index to get the array index for.