public class StableManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
free
The head of the free elements in position, if they are chained.
|
protected static int |
FREE_POSITION
An invalid value for an in-use element of positions.
|
protected int[] |
positions
This array maps from the exported ipos values (indexes in the positions
array) to the ipos of the underlying SimpleVector base.
|
Constructor and Description |
---|
StableManager(SimpleVector base) |
Modifier and Type | Method and Description |
---|---|
protected void |
adjustPositions(int low,
int high,
int delta)
Add a delta to all positions elements that point into a given range.
|
protected int |
allocPositionIndex() |
protected void |
chainFreelist()
Put all free elements in positions in a chain starting with free.
|
void |
consumePosRange(int iposStart,
int iposEnd,
Consumer out) |
int |
copyPos(int ipos) |
int |
createPos(int index,
boolean isAfter) |
int |
endPos() |
protected void |
gapReserve(SimpleVector base,
int where,
int needed)
Adjust gap to 'where', and make sure it is least `needed'
elements long.
|
boolean |
hasNext(int ipos) |
protected boolean |
isAfterPos(int ipos) |
int |
nextIndex(int ipos) |
int |
nextPos(int ipos) |
void |
releasePos(int ipos) |
protected void |
removePosRange(int ipos0,
int ipos1) |
int |
startPos() |
protected void |
unchainFreelist()
Set all free elements in positions to FREE_POSITION.
|
protected int[] positions
protected int free
protected static final int FREE_POSITION
public StableManager(SimpleVector base)
protected void chainFreelist()
protected void unchainFreelist()
public int startPos()
public int endPos()
protected int allocPositionIndex()
public int createPos(int index, boolean isAfter)
protected boolean isAfterPos(int ipos)
public boolean hasNext(int ipos)
public int nextPos(int ipos)
public int nextIndex(int ipos)
public void releasePos(int ipos)
public int copyPos(int ipos)
protected void gapReserve(SimpleVector base, int where, int needed)
protected void adjustPositions(int low, int high, int delta)
x==positions[i]
, then if
(unsigned)x>=(unsigned)low && (unsigned)x <= (unsigned)high
,
then add delta
to positions[i]
.
Using unsigned comparisons allows us to compare ipos values,
which include both the index and the isAfter low-order bit.protected void removePosRange(int ipos0, int ipos1)
public void consumePosRange(int iposStart, int iposEnd, Consumer out)