Google is committed to advancing racial equity for Black communities. See how.

SlotTable

class SlotTable
kotlin.Any
   ↳ androidx.compose.runtime.SlotTable

Summary

Public constructors

Public methods
Int

Return the group index for anchor.

String

A debugging aid that renders the slot table as a string.

SlotReader

Open a reader.

SlotWriter

Open a writer.

Boolean
ownsAnchor(anchor: Anchor)

Returns true if anchor is owned by this SlotTable or false if it is owned by a different SlotTable or no longer part of this table (e.

T
read(block: (reader: SlotReader) -> T)

Read the slot table in block.

Unit

A debugging aid to validate the internal structure of the slot table.

T
write(block: (writer: SlotWriter) -> T)

Write to the slot table in block.

Properties
IntArray

An array to store group information that is stored as groups of Group_Fields_Size elements of the array.

Int

The number of groups contained in groups.

Boolean

Returns true if the slot table is empty

Array<Any?>

An array that stores the slots for a group.

Int

The number of slots used in slots.

Public constructors

<init>

SlotTable()

Public methods

anchorIndex

fun anchorIndex(anchor: Anchor): Int

Return the group index for anchor. This SlotTable is assumed to own anchor but that is not validated. If anchor is not owned by this SlotTable the result is undefined. If a SlotWriter is open the SlotWriter.anchorIndex must be called instead as anchor might be affected by the modifications being performed by the SlotWriter.

asString

fun asString(): String

A debugging aid that renders the slot table as a string. toString is avoided as this is potentially a very expensive operation for large slot tables and calling it in the debugger should never be implicit.

openReader

fun openReader(): SlotReader

Open a reader. Any number of readers can be created but a slot table cannot be read while it is being written to.

See Also

openWriter

fun openWriter(): SlotWriter

Open a writer. Only one writer can be created for a slot table at a time and all readers must be closed an do readers can be created while the slot table is being written to.

See Also

ownsAnchor

fun ownsAnchor(anchor: Anchor): Boolean

Returns true if anchor is owned by this SlotTable or false if it is owned by a different SlotTable or no longer part of this table (e.g. it was moved or the group it was an anchor for was removed).

read

inline fun <T> read(block: (reader: SlotReader) -> T): T

Read the slot table in block. Any number of readers can be created but a slot table cannot be read while it is being written to.

See Also

verifyWellFormed

fun verifyWellFormed(): Unit

A debugging aid to validate the internal structure of the slot table. Throws an exception if the slot table is not in the expected shape.

write

inline fun <T> write(block: (writer: SlotWriter) -> T): T

Write to the slot table in block. Only one writer can be created for a slot table at a time and all readers must be closed an do readers can be created while the slot table is being written to.

See Also

Properties

groups

var groups: IntArray

An array to store group information that is stored as groups of Group_Fields_Size elements of the array. The groups array can be thought of as an array of an inline struct.

groupsSize

var groupsSize: Int

The number of groups contained in groups.

isEmpty

val isEmpty: Boolean

Returns true if the slot table is empty

slots

var slots: Array<Any?>

An array that stores the slots for a group. The slot elements for a group start at the offset returned by dataAnchor of groups and continue to the next group's slots or to slotsSize for the last group. When in a writer the dataAnchor is an anchor instead of an index as slots might contain a gap.

slotsSize

var slotsSize: Int

The number of slots used in slots.