NybbleArray

class NybbleArray(val bytes: ByteArray, val size: Int) : Iterable<Byte>

A NybbleArray offers dense storage of nybbles, i.e., values in 0,15. Even indices correspond to low nybbles of bytes, whereas odd indices correspond to high nybbles of bytes.

Author

Todd L Smith

Constructors

Link copied to clipboard
constructor(bytes: ByteArray, size: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The underlying ByteArray that supports primitive data storage.

Link copied to clipboard
val size: Int

The number of nybbles available, corresponding to the first size nybbles of bytes.

Functions

Link copied to clipboard
open fun forEach(p0: Consumer<in Byte>)
Link copied to clipboard
operator fun get(index: Int): Byte

Answer the nybble at the given zero-based index.

Link copied to clipboard

Answer a NybbleInputStream positioned at the specified index.

Link copied to clipboard

Determine whether the receiver is empty.

Link copied to clipboard

Determine whether the receiver is nonempty.

Link copied to clipboard
open operator override fun iterator(): Iterator<Byte>

Answer an iterator over the nybbles in the receiver.

Link copied to clipboard
inline fun <T, R> Iterable<T>.mapToSet(destination: MutableSet<R> = mutableSetOf(), transform: (T) -> R): MutableSet<R>

Transform the receiver via the supplied function and collect the results into an optionally provided set. Answer the result set.

Link copied to clipboard
operator fun set(index: Int, value: Byte)

Sets the nybble at the given index to the given value.

Link copied to clipboard
Link copied to clipboard
open override fun toString(): String