StructureND

interface StructureND<T>

Represents n-dimensional structure, i.e. multidimensional container of items of the same type and size. The number of dimensions and items in an array is defined by its shape, which is a sequence of non-negative integers that specify the sizes of each dimension.

StructureND is in general identity-free. StructureND.contentEquals should be used in tests to compare contents.

Parameters

T

the type of items.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

elements
Link copied to clipboard
common
abstract fun elements(): Sequence<Pair<IntArray, T>>
Returns the sequence of all the elements associated by their indices.
get
Link copied to clipboard
common
abstract operator fun get(index: IntArray): T
Returns the value at the specified indices.
getFeature
Link copied to clipboard
common
open fun <F : StructureFeature> getFeature(type: KClass<out F>): F?
Feature is some additional strucure information which allows to access it special properties or hints.

Properties

dimension
Link copied to clipboard
common
open val dimension: Int
The count of dimensions in this structure.
shape
Link copied to clipboard
common
abstract val shape: IntArray
The shape of structure, i.e.

Inheritors

BufferND
Link copied to clipboard
Structure1D
Link copied to clipboard
Structure2D
Link copied to clipboard
MutableStructureND
Link copied to clipboard

Extensions

as1D
Link copied to clipboard
common
fun <T> StructureND<T>.as1D(): Structure1D<T>
Represent a StructureND as Structure1D.
as2D
Link copied to clipboard
common
fun <T> StructureND<T>.as2D(): Structure2D<T>
Represent a StructureND as Structure1D.
combine
Link copied to clipboard
common
inline fun <T : Any> StructureND<T>.combine(struct: StructureND<T>, crossinline block: (T, T) -> T): StructureND<T>
get
Link copied to clipboard
common
operator fun <T> StructureND<T>.get(vararg index: Int): T
Returns the value at the specified indices.
getFeature
Link copied to clipboard
common
inline fun <T : StructureFeature> StructureND<*>.getFeature(): T?
mapToBuffer
Link copied to clipboard
common
inline fun <T, R : Any> StructureND<T>.mapToBuffer(factory: BufferFactory<R> = Buffer.Companion::auto, crossinline transform: (T) -> R): BufferND<R>
Transform structure to a new structure using provided BufferFactory and optimizing if argument is BufferND