public abstract class SimpleVector<E> extends IndirectIndexable<E> implements Array<E>, java.io.Externalizable, java.util.RandomAccess
This uses a simple data array along with an optional index mapper.
If indexes (the index mapper) is null, then get(i)
is data[i].
Otherwise, get(i) is data[indexes.intAt(i)].
This allows general indirection and selection: Typically indexes
will be a Range but it can be any IntSequence.
If the sequence change size, then indexes is restricted
to either a GapManager or a StableManager (which
extends GapManager). Those are usually created lazily: A plain
GapManager on the first insertion or deletion;
a StableManager if a Marker is requested.
If indexes is the special object cantWriteMarker
then this sequence is immutable.
cantWriteMarker, indexesATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, ELEMENT_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE| Constructor and Description |
|---|
SimpleVector() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o)
See java.util.Collection.
|
void |
add(int index,
E o)
See java.util.List.
|
protected int |
addPos(int ipos,
E value)
Add a value at a specified Pos.
|
protected void |
addSpace(int index,
int count)
Insert count unspecified elements at index.
|
protected abstract void |
clearBuffer(int start,
int count) |
void |
delete(int start,
int end) |
void |
fill(E value) |
E |
get(int index)
See java.util.List.
|
protected abstract java.lang.Object |
getBuffer() |
protected abstract E |
getBuffer(int index) |
protected GapManager |
getGapManager() |
E |
getRowMajor(int i) |
long |
getSegment(int index)
Get sub-range of this vector, starting at given index.
|
int |
getSegment(int index,
int len) |
int |
getSegmentReadOnly(int start,
int len) |
protected StableManager |
getStableManager() |
java.lang.String |
getTag()
This is convenience hack for printing "uniform vectors" (srfi 4).
|
protected boolean |
isAfterPos(int ipos)
Tests whether the position has the "isAfter" property.
|
void |
readExternal(java.io.ObjectInput in) |
E |
set(int index,
E value)
See java.util.List.
|
void |
setAt(int index,
E value)
A set without a get - may avoid useless boxing.
|
protected abstract void |
setBuffer(int index,
E value) |
protected abstract void |
setBuffer(java.lang.Object obj) |
abstract void |
setBufferLength(int length) |
void |
shift(int srcStart,
int dstStart,
int count) |
java.lang.Object |
toDataArray() |
Array |
transpose(int[] lowBounds,
int[] dimensions,
int offset0,
int[] factors) |
void |
writeExternal(java.io.ObjectOutput out) |
checkCanWrite, getBufferLength, getIndexesForce, indexesSelect, indexesSubList, nextPos, select, size, subList, withIndexesaddAll, addAll, boundedHash, clear, compare, compare, compare, consume, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createPos, createRelativePos, elements, endPos, equals, equals, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasNext, hasPrevious, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, setPosNext, setPosPrevious, stableCompare, startPos, subSequence, subSequencePos, toArray, toArray, toString, toString, unsupported, unsupportedExceptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitget, getEffectiveIndex, getLowBound, getSize, isEmpty, rank, setaddAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, toArray, toArrayconsumeboundedHashprotected GapManager getGapManager()
protected StableManager getStableManager()
protected abstract void setBuffer(java.lang.Object obj)
public abstract void setBufferLength(int length)
public long getSegment(int index)
(size<<32)|where
such that get(i) is data[where];
get(i+1) is data[where+1];
until get(i+size-1).
The size is at least 1 (unless index==size()),
but we try to do better.public int getSegment(int index,
int len)
public int getSegmentReadOnly(int start,
int len)
protected boolean isAfterPos(int ipos)
AbstractSequenceisAfterPos in class IndirectIndexable<E>protected abstract java.lang.Object getBuffer()
public E get(int index)
AbstractSequencepublic E getRowMajor(int i)
getRowMajor in interface Array<E>protected abstract E getBuffer(int index)
public E set(int index, E value)
Sequencepublic void setAt(int index,
E value)
Sequenceprotected abstract void setBuffer(int index,
E value)
public void fill(E value)
public void shift(int srcStart,
int dstStart,
int count)
public boolean add(E o)
AbstractSequenceadd in interface java.util.Collection<E>add in interface java.util.List<E>add in class AbstractSequence<E>public void add(int index,
E o)
AbstractSequenceadd in interface java.util.List<E>add in class AbstractSequence<E>protected int addPos(int ipos,
E value)
AbstractSequenceaddPos in class AbstractSequence<E>protected void addSpace(int index,
int count)
public void delete(int start,
int end)
protected abstract void clearBuffer(int start,
int count)
public java.lang.Object toDataArray()
public java.lang.String getTag()
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundException