Buffer

interface Buffer<out T>

A generic read-only random-access structure for both primitives and objects.

Buffer is in general identity-free. Buffer.contentEquals should be used for content equality checks.

Parameters

T

the type of elements contained in the buffer.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

get
Link copied to clipboard
common
abstract operator fun get(index: Int): T
Gets element at given index.
iterator
Link copied to clipboard
common
abstract operator fun iterator(): Iterator<T>
Iterates over all elements.
toString
Link copied to clipboard
common
abstract override fun toString(): String

Properties

size
Link copied to clipboard
common
abstract val size: Int
The size of this buffer.

Inheritors

Structure1D
Link copied to clipboard
ReadOnlyBuffer
Link copied to clipboard
VirtualBuffer
Link copied to clipboard
FlaggedBuffer
Link copied to clipboard
FlaggedDoubleBuffer
Link copied to clipboard
ListBuffer
Link copied to clipboard
MemoryBuffer
Link copied to clipboard
MutableBuffer
Link copied to clipboard

Extensions

asIterable
Link copied to clipboard
common
fun <T> Buffer<T>.asIterable(): Iterable<T>
Creates an iterable that returns all elements from this Buffer.
asND
Link copied to clipboard
common
fun <T> Buffer<T>.asND(): Structure1D<T>
Represent this buffer as 1D structure
asReadOnly
Link copied to clipboard
common
fun <T> Buffer<T>.asReadOnly(): Buffer<T>
Convert this buffer to read-only buffer.
asSequence
Link copied to clipboard
common
fun <T> Buffer<T>.asSequence(): Sequence<T>
Creates a sequence that returns all elements from this Buffer.
div
Link copied to clipboard
common
open operator fun Buffer<Double>.div(b: Buffer<Double>): Buffer<Double>
Division of two elements.
open operator fun Buffer<Double>.div(k: Number): Buffer<Double>
Division of this element by scalar.
fold
Link copied to clipboard
common
inline fun <T : Any, R> Buffer<T>.fold(initial: R, operation: (R, T) -> R): R
Fold given buffer according to operation
indices
Link copied to clipboard
common
val Buffer<*>.indices: IntRange
Returns an IntRange of the valid indices for this Buffer.
map
Link copied to clipboard
common
inline fun <T : Any, R : Any> Buffer<T>.map(block: (T) -> R): Buffer<R>
Create a new buffer from this one with the given mapping function and using Buffer.Companion.auto buffer factory.
inline fun <T : Any, R : Any> Buffer<T>.map(bufferFactory: BufferFactory<R>, crossinline block: (T) -> R): Buffer<R>
Create a new buffer from this one with the given mapping function.
mapIndexed
Link copied to clipboard
common
inline fun <T : Any, R : Any> Buffer<T>.mapIndexed(bufferFactory: BufferFactory<R> = Buffer.Companion::auto, crossinline block: (index: Int, T) -> R): Buffer<R>
Create a new buffer from this one with the given indexed mapping function.
minus
Link copied to clipboard
common
open operator override fun Buffer<Double>.minus(b: Buffer<Double>): DoubleBuffer
Subtraction of two elements.
plus
Link copied to clipboard
common
open operator override fun Buffer<Double>.plus(b: Buffer<Double>): DoubleBuffer
Addition of two elements.
pow
Link copied to clipboard
common
open infix fun Buffer<Double>.pow(pow: Number): Buffer<Double>
Raises this value to the power pow.
times
Link copied to clipboard
common
open operator fun Buffer<Double>.times(b: Buffer<Double>): Buffer<Double>
Multiplies this element by scalar.
open operator fun Buffer<Double>.times(k: Number): Buffer<Double>
Multiplication of this element by a scalar.
toDoubleArray
Link copied to clipboard
common
fun Buffer<Double>.toDoubleArray(): DoubleArray
Returns a new DoubleArray containing all the elements of this Buffer.
toFloatArray
Link copied to clipboard
common
fun Buffer<Float>.toFloatArray(): FloatArray
Returns a new FloatArray containing all the elements of this Buffer.
toIntArray
Link copied to clipboard
common
fun Buffer<Int>.toIntArray(): IntArray
Returns a new IntArray containing all the elements of this Buffer.
toList
Link copied to clipboard
common
fun <T> Buffer<T>.toList(): List<T>
Returns a new List containing all elements of this buffer.
toLongArray
Link copied to clipboard
common
fun Buffer<Long>.toLongArray(): LongArray
Returns a new LongArray containing all the elements of this Buffer.
toMutableList
Link copied to clipboard
common
fun <T> Buffer<T>.toMutableList(): MutableList<T>
Returns a new MutableList filled with all elements of this buffer.
toShortArray
Link copied to clipboard
common
fun Buffer<Short>.toShortArray(): ShortArray
Returns a new ShortArray containing all the elements of this Buffer.
toTypedArray
Link copied to clipboard
common
inline fun <T> Buffer<T>.toTypedArray(): Array<T>
Returns a new Array containing all elements of this buffer.
unaryMinus
Link copied to clipboard
common
open operator override fun Buffer<Double>.unaryMinus(): DoubleBuffer
The negation of this element.
unaryPlus
Link copied to clipboard
common
open operator fun Buffer<Double>.unaryPlus(): Buffer<Double>
Returns this value.
zip
Link copied to clipboard
common
inline fun <T1 : Any, T2 : Any, R : Any> Buffer<T1>.zip(other: Buffer<T2>, bufferFactory: BufferFactory<R> = Buffer.Companion::auto, crossinline transform: (T1, T2) -> R): Buffer<R>
Zip two buffers using given transform.

Sources

common source
Link copied to clipboard