public class CompactList extends Object implements Iterable<org.agrona.MutableDirectBuffer>, CloseableSilently
| Modifier and Type | Field and Description |
|---|---|
protected AllocatedBuffer |
allocatedBuffer |
protected org.agrona.concurrent.UnsafeBuffer |
elementBuffer |
protected int |
framedElementLength |
protected CompactListIterator |
iterator |
protected org.agrona.concurrent.UnsafeBuffer |
listBuffer |
| Constructor and Description |
|---|
CompactList(AllocatedBuffer allocatedBuffer,
int elementMaxLength,
int capacity) |
CompactList(int elementMaxLength,
int capacity,
BufferAllocator bufferAllocator) |
CompactList(org.agrona.concurrent.UnsafeBuffer listBuffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.agrona.DirectBuffer srcBuffer)
Appends the passed element to the end of the list.
|
void |
add(org.agrona.DirectBuffer srcBuffer,
int offset,
int length)
Appends the passed element to the end of the list.
|
void |
add(org.agrona.DirectBuffer srcBuffer,
int offset,
int length,
int idx)
Adds the passed element at the given index.
|
protected void |
boundsCheck(int index,
int size) |
protected void |
boundsCheckIncludingSize(int index,
int size) |
int |
capacity()
Returns this list's capacity.
|
void |
clear()
Removes all of the elements from this list.
|
void |
close() |
int |
copyInto(org.agrona.MutableDirectBuffer dstBuffer,
int offset)
Copy the underlying buffer into a supplied
MutableDirectBuffer. |
protected void |
elementLengthCheck(int length) |
int |
find(org.agrona.DirectBuffer key,
Comparator<org.agrona.DirectBuffer> c)
Searches the list for the specified key using the binary search algorithm.
|
int |
get(int idx,
org.agrona.MutableDirectBuffer dstBuffer,
int offset)
Get the element from the list into a supplied
MutableDirectBuffer. |
int |
getEncodedSize() |
org.agrona.DirectBuffer |
getRawBuffer() |
protected IndexOutOfBoundsException |
indexOutOfBoundsException(int index,
int size) |
CompactListIterator |
iterator() |
int |
maxElementDataLength()
Returns the maximal element data length.
|
void |
remove(int idx)
Removes the element at the specified position in this list.
|
void |
set(int idx,
org.agrona.DirectBuffer srcBuffer)
Replaces the element at the specified position in this list with the specified element.
|
void |
set(int idx,
org.agrona.DirectBuffer srcBuffer,
int offset,
int length)
Replaces the element at the specified position in this list with the specified element.
|
protected void |
setMemory(int idx,
int length,
byte value) |
protected void |
setSize(int size) |
protected void |
setValue(org.agrona.DirectBuffer buffer,
int offset,
int length,
int idx) |
protected void |
setValue(org.agrona.DirectBuffer buffer,
int offset,
int length,
int idx,
int elementOffset) |
int |
size()
Returns the number of contained elements by the list.
|
int |
sizeVolatile() |
InputStream |
toInputStream() |
int |
wrap(int idx,
org.agrona.MutableDirectBuffer dstBuffer)
Attach a view of the element to a
MutableDirectBuffer for providing direct access. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorprotected final AllocatedBuffer allocatedBuffer
protected final org.agrona.concurrent.UnsafeBuffer listBuffer
protected final org.agrona.concurrent.UnsafeBuffer elementBuffer
protected final int framedElementLength
protected final CompactListIterator iterator
public CompactList(int elementMaxLength,
int capacity,
BufferAllocator bufferAllocator)
public CompactList(AllocatedBuffer allocatedBuffer, int elementMaxLength, int capacity)
public CompactList(org.agrona.concurrent.UnsafeBuffer listBuffer)
public void add(org.agrona.DirectBuffer srcBuffer)
srcBuffer - from which the element bytes will be copied.public void add(org.agrona.DirectBuffer srcBuffer,
int offset,
int length)
srcBuffer - from which the element bytes will be copied.offset - at which the element begins.length - of the element.public void add(org.agrona.DirectBuffer srcBuffer,
int offset,
int length,
int idx)
srcBuffer - from which the element bytes will be copied.offset - at which the element begins.length - of the element.idx - at which the specified element is to be inserted.public void set(int idx,
org.agrona.DirectBuffer srcBuffer)
idx - of the element to replacesrcBuffer - from which the element bytes will be copied.public void set(int idx,
org.agrona.DirectBuffer srcBuffer,
int offset,
int length)
idx - of the element to replacesrcBuffer - from which the element bytes will be copied.offset - at which the element begins.length - of the element.public void remove(int idx)
idx - of the element to be removed.public int size()
public int sizeVolatile()
public int capacity()
public int maxElementDataLength()
public int get(int idx,
org.agrona.MutableDirectBuffer dstBuffer,
int offset)
MutableDirectBuffer.idx - the element to supply.dstBuffer - into which the element will be copied.offset - of the supplied buffer to use.public int wrap(int idx,
org.agrona.MutableDirectBuffer dstBuffer)
MutableDirectBuffer for providing direct access.idx - the element to attach.dstBuffer - to which the view of the element is attached.public int getEncodedSize()
public org.agrona.DirectBuffer getRawBuffer()
public int find(org.agrona.DirectBuffer key,
Comparator<org.agrona.DirectBuffer> c)
key - to be searched for.c - used for comparison.public int copyInto(org.agrona.MutableDirectBuffer dstBuffer,
int offset)
MutableDirectBuffer.dstBuffer - into which the underlying buffer is copied.offset - of the supplied buffer to use.public void clear()
protected void boundsCheck(int index,
int size)
protected void boundsCheckIncludingSize(int index,
int size)
protected IndexOutOfBoundsException indexOutOfBoundsException(int index, int size)
protected void elementLengthCheck(int length)
protected void setSize(int size)
protected void setValue(org.agrona.DirectBuffer buffer,
int offset,
int length,
int idx)
protected void setValue(org.agrona.DirectBuffer buffer,
int offset,
int length,
int idx,
int elementOffset)
protected void setMemory(int idx,
int length,
byte value)
public CompactListIterator iterator()
public InputStream toInputStream()
public void close()
close in interface CloseableSilentlyclose in interface AutoCloseableCopyright © 2017–2019 camunda services GmbH. All rights reserved.