StructureND

interface StructureND<out T> : Featured<StructureFeature>

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 override fun <F : StructureFeature> getFeature(type: KClass<out F>): F?
Feature is some additional structure information that 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., non-empty sequence of non-negative integers that specify sizes of dimensions of this structure.

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>
Represents a StructureND as Structure2D.
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.
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

Sources

common source
Link copied to clipboard