gnu.lists
Class SimpleVector
public abstract
class
SimpleVector
extends AbstractSequence
implements Sequence, Array
A SimpleVector implement as a simple array plus a current size.
Methods with the word "Buffer" are methods which use the underlying
array, ignoring the 'size' field.
Can be used to implement CommonLisp simple vectors, but all simple
vectors are also adjustable (by re-allocating the buffer)
and have a fill pointer (the size field).
Method Summary |
boolean | add(Object o) |
void | add(int index, Object o) |
boolean | addAll(int index, Collection c) |
protected int | addPos(int ipos, Object value) |
void | clear() |
protected abstract void | clearBuffer(int start, int count) |
protected static int | compareToInt(SimpleVector v1, SimpleVector v2) |
protected static int | compareToLong(SimpleVector v1, SimpleVector v2) |
void | consume(int start, int length, Consumer out) |
boolean | consumeNext(int ipos, Consumer out) |
void | consumePosRange(int iposStart, int iposEnd, Consumer out) |
int | createPos(int index, boolean isAfter) |
void | fill(Object value) |
void | fill(int fromIndex, int toIndex, Object value) |
void | fillPosRange(int fromPos, int toPos, Object value) |
Object | get(int index) |
protected abstract Object | getBuffer() |
protected abstract Object | getBuffer(int index) |
abstract int | getBufferLength() Get the allocated length of the data buffer. |
int | getElementKind() |
int | getNextKind(int ipos) |
Object | getPosNext(int ipos) |
Object | getRowMajor(int i) |
String | getTag() This is convenience hack for printing "uniform vectors" (srfi 4).
|
int | intAt(int index) |
int | intAtBuffer(int index) |
protected boolean | isAfterPos(int ipos) |
long | longAt(int index) |
long | longAtBuffer(int index) |
protected int | nextIndex(int ipos) |
int | nextPos(int ipos) |
Object | remove(int index) |
boolean | remove(Object o) |
boolean | removeAll(Collection c) |
void | removePos(int ipos, int count) |
protected void | removePosRange(int ipos0, int ipos1) |
boolean | retainAll(Collection c) |
Object | set(int index, Object value) |
protected abstract Object | setBuffer(int index, Object value) |
abstract void | setBufferLength(int length) |
void | setSize(int size)
Set the size to a specified value.
|
void | shift(int srcStart, int dstStart, int count) |
int | size() |
Array | transpose(int[] lowBounds, int[] dimensions, int offset0, int[] factors) |
public int size
The (current) number of elements.
Must always have size() >= 0 && size() <= getBufferLength().
public boolean add(Object o)
public void add(int index, Object o)
public boolean addAll(int index, Collection c)
protected int addPos(int ipos, Object value)
public void clear()
protected abstract void clearBuffer(int start, int count)
public void consume(int start, int length,
Consumer out)
public boolean consumeNext(int ipos,
Consumer out)
public void consumePosRange(int iposStart, int iposEnd,
Consumer out)
public int createPos(int index, boolean isAfter)
public void fill(Object value)
public void fill(int fromIndex, int toIndex, Object value)
public void fillPosRange(int fromPos, int toPos, Object value)
public Object get(int index)
protected abstract Object getBuffer()
protected abstract Object getBuffer(int index)
public abstract int getBufferLength()
Get the allocated length of the data buffer.
public int getElementKind()
public int getNextKind(int ipos)
public Object getPosNext(int ipos)
public Object getRowMajor(int i)
public String getTag()
This is convenience hack for printing "uniform vectors" (srfi 4).
It may go away without notice!
public int intAt(int index)
public int intAtBuffer(int index)
protected boolean isAfterPos(int ipos)
public long longAt(int index)
public long longAtBuffer(int index)
protected int nextIndex(int ipos)
public int nextPos(int ipos)
public Object remove(int index)
public boolean remove(Object o)
public boolean removeAll(Collection c)
public void removePos(int ipos, int count)
protected void removePosRange(int ipos0, int ipos1)
public boolean retainAll(Collection c)
public Object set(int index, Object value)
protected abstract Object setBuffer(int index, Object value)
public abstract void setBufferLength(int length)
public void setSize(int size)
Set the size to a specified value.
The data buffer is grown if needed, with new elements set to zero/null. If
size is less than the current value, removed values are set to zero/null..
(This is because if you decrease and then increase the vector the
should be zero/null, and it is cleaner and better for gc to do the
zeroing/nulling on remove rather than add.)
If you need to change the size without setting removed elements to
zero/null (e.g. to change Common Lisp's fill pointer) set size directly.
public void shift(int srcStart, int dstStart, int count)
public final int size()
public
Array transpose(int[] lowBounds, int[] dimensions, int offset0, int[] factors)