public abstract class CompoundVecBuffer
extends java.lang.Object
VecBuffer
objects. Each VecBuffer is retrieved via an index. The range of valid indices in a
CompoundVecBuffer is [0, size() - 1], inclusive. Implementations of CompoundVecBuffer define how each VecBuffer is
stored and retrieved according to its index.
To retrieve a single VecBuffer given an index, invoke subBuffer(int)
. To retrieve a VecBuffer's size, in
number of logical tuples, invoke subBufferSize(int)
.
To create a new view of this CompoundVecBuffer from one or many VecBuffers, invoke one of the slice
methods: slice(int, int)
creates a view of this CompoundVecbufer given a contiguous sequence of
VecBuffer indices.slice(int[], int, int)
creates a view of this CompoundVecBuffer given an array
of VecBuffer indices.Modifier and Type | Class and Description |
---|---|
protected class |
CompoundVecBuffer.CompoundIterator<T> |
protected class |
CompoundVecBuffer.CoordIterable |
protected static class |
CompoundVecBuffer.EmptyCompoundVecBuffer |
protected class |
CompoundVecBuffer.LocationIterable |
protected class |
CompoundVecBuffer.PositionIterable |
protected class |
CompoundVecBuffer.ReverseCompoundIterator<T> |
protected static interface |
CompoundVecBuffer.SubBufferIterable<T> |
protected class |
CompoundVecBuffer.VectorIterable |
Modifier and Type | Field and Description |
---|---|
protected static boolean |
ALLOCATE_DIRECT_BUFFERS |
protected int |
capacity |
protected int |
count |
protected static int |
DEFAULT_INITIAL_CAPACITY |
protected java.nio.IntBuffer |
lengths |
protected java.nio.IntBuffer |
offsets |
Modifier | Constructor and Description |
---|---|
|
CompoundVecBuffer()
Constructs a CompoundVecBuffer with the default initial capacity.
|
protected |
CompoundVecBuffer(CompoundVecBuffer that,
int[] indices,
int offset,
int length) |
protected |
CompoundVecBuffer(CompoundVecBuffer that,
int beginIndex,
int endIndex) |
|
CompoundVecBuffer(int capacity)
Constructs a CompoundVecBuffer with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
protected int |
addSubBuffer(int offset,
int length) |
void |
clear()
Sets the number sub-buffers to zero.
|
protected abstract CompoundVecBuffer |
createSlice(int[] indices,
int offset,
int length) |
protected abstract CompoundVecBuffer |
createSlice(int beginIndex,
int endIndex) |
protected abstract VecBuffer |
createSubBuffer(int offset,
int length) |
static CompoundVecBuffer |
emptyCompoundVecBuffer(int coordsPerVec)
Returns an empty CompoundVecBuffer.
|
protected void |
expandCapacity(int minCapacity) |
java.lang.Iterable<double[]> |
getCoords()
Returns an iterator over this buffer's logical vectors, as double[] coordinate arrays.
|
java.lang.Iterable<double[]> |
getCoords(int minCoordsPerVec)
Returns an iterator over this buffer's logical vectors, as double[] coordinate arrays.
|
abstract int |
getCoordsPerVec()
Returns the number of coordinates per logical vector element.
|
java.lang.Iterable<? extends LatLon> |
getLocations()
Returns an iterator over this buffer's logical vectors, as LatLon locations.
|
java.lang.Iterable<? extends Position> |
getPositions()
Returns an iterator over this buffer's logical vectors, as geographic Positions.
|
java.lang.Iterable<double[]> |
getReverseCoords(int minCoordsPerVec)
Returns a reverse iterator over this buffer's logical vectors, as double[] coordinate arrays.
|
java.lang.Iterable<? extends LatLon> |
getReverseLocations()
Returns a reverse iterator over this buffer's logical vectors, as LatLon locations.
|
java.lang.Iterable<? extends Position> |
getReversePositions()
Returns a reverse iterator over this buffer's logical vectors, as geographic Positions.
|
java.lang.Iterable<? extends Vec4> |
getReverseVectors()
Returns a reverse iterator over this buffer's logical vectors, as Vec4 references.
|
java.lang.Iterable<? extends Vec4> |
getVectors()
Returns an iterator over this buffer's logical vectors, as Vec4 references.
|
int |
size()
Returns the number of VecBuffers stored in this CompoundVecBuffer.
|
CompoundVecBuffer |
slice(int[] indices)
Returns a new logical view of this CompoundVecBuffer.
|
CompoundVecBuffer |
slice(int[] indices,
int offset,
int length)
Returns a new logical view of this CompoundVecBuffer.
|
CompoundVecBuffer |
slice(int beginIndex,
int endIndex)
Returns a new logical view of this CompoundVecBuffer.
|
VecBuffer |
subBuffer(int index)
Returns the sub-buffer at the specified index as a
VecBuffer . |
abstract int |
subBufferSize(int index)
Returns the size in logical vectors of the VecBuffer with the specified index.
|
protected static final boolean ALLOCATE_DIRECT_BUFFERS
protected int capacity
protected int count
protected static final int DEFAULT_INITIAL_CAPACITY
protected java.nio.IntBuffer lengths
protected java.nio.IntBuffer offsets
public CompoundVecBuffer()
protected CompoundVecBuffer(CompoundVecBuffer that, int[] indices, int offset, int length)
protected CompoundVecBuffer(CompoundVecBuffer that, int beginIndex, int endIndex)
public CompoundVecBuffer(int capacity)
capacity
- the CompoundVecBuffer's initial capacity, in number of sub-buffers.java.lang.IllegalArgumentException
- if the capacity is less than 1.protected int addSubBuffer(int offset, int length)
public void clear()
protected abstract CompoundVecBuffer createSlice(int[] indices, int offset, int length)
protected abstract CompoundVecBuffer createSlice(int beginIndex, int endIndex)
protected abstract VecBuffer createSubBuffer(int offset, int length)
public static CompoundVecBuffer emptyCompoundVecBuffer(int coordsPerVec)
coordsPerVec
- the number of coordinates per logical vector.protected void expandCapacity(int minCapacity)
public java.lang.Iterable<double[]> getCoords()
public java.lang.Iterable<double[]> getCoords(int minCoordsPerVec)
minCoordsPerVec
- the minimum number of coordinates returned in each double[] array.public abstract int getCoordsPerVec()
public java.lang.Iterable<? extends LatLon> getLocations()
public java.lang.Iterable<? extends Position> getPositions()
public java.lang.Iterable<double[]> getReverseCoords(int minCoordsPerVec)
minCoordsPerVec
- the minimum number of coordinates returned in each double[] array.public java.lang.Iterable<? extends LatLon> getReverseLocations()
public java.lang.Iterable<? extends Position> getReversePositions()
public java.lang.Iterable<? extends Vec4> getReverseVectors()
public java.lang.Iterable<? extends Vec4> getVectors()
public int size()
public CompoundVecBuffer slice(int[] indices)
indices
, and contains this buffer's contents for each index in indices
. The returned
buffer shares this buffers's backing data. Changes to this buffer are reflected in the returned buffer, and vice
versa.indices
- an array containing the indices include in the subset.java.lang.IllegalArgumentException
- if the array of indices is null, or if any of the indices is out of range.public CompoundVecBuffer slice(int[] indices, int offset, int length)
length
, and contains this buffer's contents for each index in indices
. The returned
buffer shares this buffers's backing data. Changes to this buffer are reflected in the returned buffer, and vice
versa.indices
- an array containing the indices include in the subset.offset
- the array starting index.length
- the number of array values to use.java.lang.IllegalArgumentException
- if the array of indices is null, if the offset or length are invalid, or if any
of the indices is out of range.public CompoundVecBuffer slice(int beginIndex, int endIndex)
endIndex - beginIndex
+ 1
and references this buffer's contents starting at beginIndex
, and ending at
endIndex
. The returned buffer shares this buffers's backing data. Changes to this buffer are
reflected in the returned buffer, and vice versa.beginIndex
- the index of the first sub-buffer to include in the subset.endIndex
- the index of the last sub-buffer to include in the subset.java.lang.IllegalArgumentException
- if beginIndex is out of range, if endIndex is out of range, or if beginIndex >
endIndex.public VecBuffer subBuffer(int index)
VecBuffer
.index
- the index of the VecBuffer to return.java.lang.IllegalArgumentException
- if the index is out of range.public abstract int subBufferSize(int index)
index
- the index for the VecBuffer who's size is returned.java.lang.IllegalArgumentException
- if the index is out of range.