|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.util.CompoundBuffer<T,V>
T - The backing buffer type of this CompoundBuffer.V - The sub-buffer type accepted and returned by this CompoundBuffer.public abstract class CompoundBuffer<T,V>
CompoundBuffer provides a mechanism for constructing a single buffer from a collection of buffers with potentially different length, then indexing that 'compound' buffer to reference the individual buffer content within. Compounding separate buffers in this way is useful for grouping related data into a single block of memory, which may then be managed easlily, and easily tranferred from one system to another.
| Field Summary | |
|---|---|
protected T |
buffer
|
protected static int |
DEFAULT_INITIAL_CAPACITY
|
protected int |
numSubBuffers
|
protected int |
size
|
protected java.nio.IntBuffer |
subLengthBuffer
|
protected java.nio.IntBuffer |
subPositionBuffer
|
| Constructor Summary | |
|---|---|
CompoundBuffer(int initialCapacity,
T buffer)
Constructs a CompoundBuffer with the specified initial capacity, and the specified backing buffer. |
|
CompoundBuffer(int size,
T buffer,
java.nio.IntBuffer subPositionBuffer,
java.nio.IntBuffer subLengthBuffer,
int numSubBuffers)
Creates a CompoundBuffer with the specified backing buffer size, backing buffer, sub-buffer starting positions, sub-buffer lengths, and number of sub-buffers. |
|
CompoundBuffer(T buffer)
Constructs a CompoundBuffer with the specified backing buffer, and a default initial capacity. |
|
| Method Summary | |
|---|---|
protected abstract void |
append(V buffer)
|
int |
appendEmptyBuffer()
Appends an empty sub-buffer to the end of this compound buffer. |
int |
appendSubBuffer(V subBuffer)
Appends the contents of the specified sub-buffer to the end of this compound buffer, incrementing the number of sub-buffers by one. |
void |
clear()
|
protected int |
computeNewSize(int size,
int minSize)
|
T |
getBackingBuffer()
Returns the backing buffer. |
int |
getNumSubBuffers()
Returns the number of sub-buffers contained in the compound buffer. |
protected abstract int |
getSize(V buffer)
|
V |
getSubBuffer(int index)
Returns the sub-buffer identified by the specified index. |
protected abstract V |
getSubBuffer(int position,
int length)
|
java.nio.IntBuffer |
getSubLengthBuffer()
Returns the buffer which contains the logical size of each sub-buffer in the backing buffer. |
java.nio.IntBuffer |
getSubPositionBuffer()
Returns the buffer which contains the logical starting position of each sub-buffer in the backing buffer. |
int |
getTotalBufferSize()
Returns the collective size of all sub buffers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected T buffer
protected static final int DEFAULT_INITIAL_CAPACITY
protected int numSubBuffers
protected int size
protected java.nio.IntBuffer subLengthBuffer
protected java.nio.IntBuffer subPositionBuffer
| Constructor Detail |
|---|
public CompoundBuffer(int initialCapacity,
T buffer)
initialCapacity - the initial capacity to allocate, in number of sub-buffers.buffer - the backing buffer.
java.lang.IllegalArgumentException - if the initialCapacity is negative, or if the buffer is null.
public CompoundBuffer(int size,
T buffer,
java.nio.IntBuffer subPositionBuffer,
java.nio.IntBuffer subLengthBuffer,
int numSubBuffers)
size - the backing buffer size.buffer - the backing buffer,subPositionBuffer - the sub-buffer logical starting positions.subLengthBuffer - the sub-buffer logical sizes.numSubBuffers - the number of sub-buffers.
java.lang.IllegalArgumentException - if size is negative, if any of the buffer, subPositionBuffer, subLengthBuffer
are null, or if numSubBuffers is negative.public CompoundBuffer(T buffer)
buffer - the compound buffer's backing buffer.
java.lang.IllegalArgumentException - if the buffer is null.| Method Detail |
|---|
protected abstract void append(V buffer)
public int appendEmptyBuffer()
public int appendSubBuffer(V subBuffer)
subBuffer - the sub-buffer to append.
java.lang.IllegalArgumentException - if the subBuffer is null.public void clear()
protected int computeNewSize(int size,
int minSize)
public T getBackingBuffer()
public int getNumSubBuffers()
protected abstract int getSize(V buffer)
public V getSubBuffer(int index)
index - the index of the sub-buffer to get.
java.lang.IllegalArgumentException - if the index is out of range.
protected abstract V getSubBuffer(int position,
int length)
public java.nio.IntBuffer getSubLengthBuffer()
public java.nio.IntBuffer getSubPositionBuffer()
public int getTotalBufferSize()
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||