Package io.github.alexandrepiveteau.echo.core.buffer

Types

Link copied to clipboard
interface Gap

An interface representing the Gap from a gap buffer.

Link copied to clipboard
interface MutableByteGapBuffer

An interface representing a mutable gap buffer, containing a sequence of Byte, which is optimized for chunk insertions and removals.

Link copied to clipboard
interface MutableCharGapBuffer

An interface representing a mutable gap buffer, containing a sequence of Char, which is optimized for chunk insertions and removals.

Link copied to clipboard
interface MutableEventIdentifierGapBuffer

An interface representing a mutable gap buffer, containing a sequence of EventIdentifier, which is optimized for chunk insertions and removals.

Link copied to clipboard
interface MutableGapBuffer<T>

An interface representing a mutable gap buffer, containing a sequence of T, which is optimized for chunk insertions and removals.

Link copied to clipboard
interface MutableIntGapBuffer

An interface representing a mutable gap buffer, containing a sequence of Int, which is optimized for chunk insertions and removals.

Functions

Link copied to clipboard
fun MutableEventIdentifierGapBuffer.binarySearch(    element: EventIdentifier,     fromIndex: Int = 0,     toIndex: Int = size): Int

Searches this MutableEventIdentifierGapBuffer for the provided element using the binary search algorithm. The array is expected to be sorted, otherwise the result is undefined.

fun MutableIntGapBuffer.binarySearch(    element: Int,     fromIndex: Int = 0,     toIndex: Int = size): Int

Searches this MutableIntGapBuffer for the provided element using the binary search algorithm. The array is expected to be sorted, otherwise the result is undefined.

Link copied to clipboard
fun MutableEventIdentifierGapBuffer.binarySearchBySite(    element: SiteIdentifier,     fromIndex: Int = 0,     toIndex: Int = size): Int

Searches this MutableEventIdentifierGapBuffer for the provided element using the binary search algorithm. The array is expected to be sorted by site identifiers, otherwise the result is undefined.

Link copied to clipboard
fun MutableByteGapBuffer.copyOfRange(from: Int, until: Int): ByteArray

Copies the given range from the MutableByteGapBuffer.

fun MutableCharGapBuffer.copyOfRange(from: Int, until: Int): CharArray

Copies the given range from the MutableCharGapBuffer.

fun MutableEventIdentifierGapBuffer.copyOfRange(from: Int, until: Int): EventIdentifierArray

Copies the given range from the MutableEventIdentifierGapBuffer.

inline fun <T> MutableGapBuffer<T>.copyOfRange(from: Int, until: Int): Array<T>

Copies the given range from the MutableGapBuffer.

fun MutableIntGapBuffer.copyOfRange(from: Int, until: Int): IntArray

Copies the given range from the MutableIntGapBuffer.

Link copied to clipboard
fun MutableEventIdentifierGapBuffer.linearSearch(value: EventIdentifier): Int

Returns the insertion index for the given EventIdentifier. The insertion index can be seen as the index at which the cursor should be moved when inserting an event with the given sequence number and site identifier that would preserve the sorted behavior of the buffer.

fun MutableIntGapBuffer.linearSearch(value: Int): Int

Returns the insertion index for the given Int. The insertion index can be seen as the index at which the cursor should be moved when inserting an event with the given sequence number and site identifier that would preserve the sorted behavior of the buffer.

Link copied to clipboard
fun MutableByteGapBuffer(size: Int): MutableByteGapBuffer

Creates a MutableByteGapBuffer with a given size, where each cell is init at zero.

fun MutableByteGapBuffer(size: Int, init: (Int) -> Byte): MutableByteGapBuffer

Creates a MutableByteGapBuffer with a given size, where each item is init.

Link copied to clipboard
fun mutableByteGapBufferOf(): MutableByteGapBuffer

Creates an empty MutableByteGapBuffer.

Link copied to clipboard
fun MutableCharGapBuffer(size: Int): MutableCharGapBuffer

Creates a MutableCharGapBuffer with a given size, where each cell is init at zero.

fun MutableCharGapBuffer(size: Int, init: (Int) -> Char): MutableCharGapBuffer

Creates a MutableCharGapBuffer with a given size, where each item is init.

Link copied to clipboard
fun mutableCharGapBufferOf(): MutableCharGapBuffer

Creates an empty MutableCharGapBuffer.

Link copied to clipboard

Creates a MutableEventIdentifierGapBuffer with a given size, where each cell is init at zero.

Creates a MutableEventIdentifierGapBuffer with a given size, where each item is init.

Link copied to clipboard
inline fun <T> MutableGapBuffer(size: Int, crossinline init: (Int) -> T): MutableGapBuffer<T>

Creates a MutableGapBuffer with a given size, where each item is init.

Link copied to clipboard
inline fun <T> mutableGapBufferOf(): MutableGapBuffer<T>

Creates an empty MutableGapBuffer.

Link copied to clipboard
fun MutableIntGapBuffer(size: Int): MutableIntGapBuffer

Creates a MutableIntGapBuffer with a given size, where each cell is init at zero.

fun MutableIntGapBuffer(size: Int, init: (Int) -> Int): MutableIntGapBuffer

Creates a MutableIntGapBuffer with a given size, where each item is init.

Link copied to clipboard
fun mutableIntGapBufferOf(): MutableIntGapBuffer

Creates an empty MutableIntGapBuffer.

Link copied to clipboard
fun MutableByteGapBuffer.pushAtGap(value: Byte)

Pushes the given Byte at the current gap cursor.

fun MutableCharGapBuffer.pushAtGap(value: Char)

Pushes the given Char at the current gap cursor.

fun MutableEventIdentifierGapBuffer.pushAtGap(value: EventIdentifier)

Pushes the given EventIdentifier at the current gap cursor.

fun <T> MutableGapBuffer<T>.pushAtGap(value: T)

Pushes the given T at the current gap cursor.

fun MutableIntGapBuffer.pushAtGap(value: Int)

Pushes the given Int at the current gap cursor.

fun MutableByteGapBuffer.pushAtGap(    array: ByteArray,     from: Int = 0,     until: Int = array.size)

Pushes an array of Byte at the current gap cursor.

fun MutableCharGapBuffer.pushAtGap(    array: CharArray,     from: Int = 0,     until: Int = array.size)

Pushes an array of Char at the current gap cursor.

fun MutableEventIdentifierGapBuffer.pushAtGap(    array: EventIdentifierArray,     from: Int = 0,     until: Int = array.size)

Pushes an array of EventIdentifier at the current gap cursor.

fun <T> MutableGapBuffer<T>.pushAtGap(    array: Array<T>,     from: Int = 0,     until: Int = array.size)

Pushes an array of T at the current gap cursor.

fun MutableIntGapBuffer.pushAtGap(    array: IntArray,     from: Int = 0,     until: Int = array.size)

Pushes an array of Int at the current gap cursor.

Link copied to clipboard
fun MutableByteGapBuffer.toByteArray(): ByteArray

Copies the contents of this MutableByteGapBuffer into a new ByteArray.

Link copied to clipboard
fun MutableCharGapBuffer.toCharArray(): CharArray

Copies the contents of this MutableCharGapBuffer into a new CharArray.

Link copied to clipboard
Link copied to clipboard
fun MutableIntGapBuffer.toIntArray(): IntArray

Copies the contents of this MutableIntGapBuffer into a new IntArray.

Link copied to clipboard

Copies the contents of this EventIdentifierArray into a new MutableEventIdentifierGapBuffer.

inline fun <T> Array<T>.toMutableGapBuffer(): MutableGapBuffer<T>

Copies the contents of this Array into a new MutableGapBuffer.

fun ByteArray.toMutableGapBuffer(): MutableByteGapBuffer

Copies the contents of this ByteArray into a new MutableByteGapBuffer.

fun CharArray.toMutableGapBuffer(): MutableCharGapBuffer

Copies the contents of this CharArray into a new MutableCharGapBuffer.

fun IntArray.toMutableGapBuffer(): MutableIntGapBuffer

Copies the contents of this IntArray into a new MutableIntGapBuffer.

Link copied to clipboard
fun MutableByteGapBuffer.toTypedArray(): Array<Byte>

Copies the contents of this MutableByteGapBuffer into a new Array of Byte.

fun MutableCharGapBuffer.toTypedArray(): Array<Char>

Copies the contents of this MutableCharGapBuffer into a new Array of Char.

Copies the contents of this MutableEventIdentifierGapBuffer into a new Array of EventIdentifier.

inline fun <T> MutableGapBuffer<T>.toTypedArray(): Array<T>

Copies the contents of this MutableGapBuffer into a new ByteArray.

fun MutableIntGapBuffer.toTypedArray(): Array<Int>

Copies the contents of this MutableIntGapBuffer into a new Array of Int.