public class CircularIndex
extends java.lang.Object
| Constructor and Description |
|---|
CircularIndex() |
| Modifier and Type | Method and Description |
|---|---|
static int |
addOffset(int index,
int offset,
int size)
Adds offset (positive or negative) to index in a circular buffer.
|
static int |
distanceP(int index0,
int index1,
int size)
Returns how many elements away in the positive direction you need to travel to get from
index0 to index1.
|
static int |
minusPOffset(int index,
int offset,
int size)
Subtracts a positive offset to index in a circular buffer.
|
static int |
plusPOffset(int index,
int offset,
int size)
Adds a positive offset to index in a circular buffer.
|
static int |
subtract(int index0,
int index1,
int size)
Subtracts index1 from index0.
|
public static int plusPOffset(int index,
int offset,
int size)
index - element in circular bufferoffset - integer which is positive and less than sizesize - size of the circular bufferpublic static int minusPOffset(int index,
int offset,
int size)
index - element in circular bufferoffset - integer which is positive and less than sizesize - size of the circular bufferpublic static int addOffset(int index,
int offset,
int size)
index - element in circular bufferoffset - offset. |offset| < sizesize - size of the circular bufferpublic static int distanceP(int index0,
int index1,
int size)
index0 - element in circular bufferindex1 - element in circular buffersize - size of the circular bufferpublic static int subtract(int index0,
int index1,
int size)
index0 - element in circular bufferindex1 - element in circular buffersize - size of the circular buffer