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

SlotReader

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

A reader of a slot table. See SlotTable

Summary

Public constructors
<init>(table: SlotTable)

A reader of a slot table.

Public methods
Anchor
anchor(index: Int = currentGroup)

Create an anchor to the current reader location or index.

Unit

Begin reporting empty for all calls to next() or get().

Unit

Close the slot reader.

Unit

End reporting EMPTY for calls to next and get,

Unit

End the current group.

MutableList<KeyInfo>

Extract the keys from this point to the end of the group.

Any?
get(index: Int)

Get the value stored at index in the parent group's slot.

Any?
groupAux(index: Int)

Get the aux data for the group at index

Int
groupEnd(index: Int)

Get location of the end of the group at index.

Any?
groupGet(index: Int)

Get the value of the group's slot at index for the currentGroup group.

Int
groupKey(index: Int)

Get the key of the group at index.

Int
groupKey(anchor: Anchor)

Get the group key at anchor.

Any?

Get the object key at index.

Int
groupSize(index: Int)

Get the size of the group at index.

Boolean
hasObjectKey(index: Int)

Determine if the group at index has an object key

Boolean
isNode(index: Int)

Determine if the group at index is a node.

Any?

Get the value of the slot at currentGroup or EMPTY if at then end of a group.

Any?
node(index: Int)

Return the node at index if index is a node group else null.

Int
nodeCount(index: Int)

Return the number of nodes for the group at index.

Int
parent(index: Int)

Return the parent index of index.

Int
parentOf(index: Int)

Return the index of the parent group of the given group

Unit
reposition(index: Int)

Reposition the read to the group at index.

Unit

Restore the parent to a parent of the current group.

Int

Skip a group.

Unit

Skip to the end of the current group.

Unit

Start a group.

Unit

Start a group and validate it is a node group

Properties
Int

The end of the parent group.

Int

The current group that will be started with startGroup or skipped with skipGroup.

Any?

Get the current group aux data.

Int

Get location the end of the currently started group.

Int

Get the key of the current group.

Any?

Get the node associated with the group if there is one.

Any?

Get the object key for the current group or null if no key was provide

Int

Get the size of the group at currentGroup.

Int

Return the number of slots allocated to the currentGroup group.

Int

The group slot index is the index into the current groups slots that will be updated by read by next.

Boolean

Determine if a beginEmpty has been called.

Boolean

Determine if the reader is at the end of a group and an endGroup is expected.

Boolean

Determine if the slot is start of a node.

Int

The number of nodes managed by the current group.

Int

The parent of the currentGroup group which is the last group started with startGroup.

Int

Return the number of nodes where emitted into the current group.

Int

Return the total number of groups in the slot table.

Int

Return the current slot of the group whose value will be returned by calling next.

Public constructors

<init>

SlotReader(table: SlotTable)

A reader of a slot table. See SlotTable

Public methods

anchor

fun anchor(index: Int = currentGroup): Anchor

Create an anchor to the current reader location or index.

beginEmpty

fun beginEmpty(): Unit

Begin reporting empty for all calls to next() or get(). beginEmpty() can be nested and must be called with a balanced number of endEmpty()

close

fun close(): Unit

Close the slot reader. After all SlotReaders have been closed the SlotTable a SlotWriter can be created.

endEmpty

fun endEmpty(): Unit

End reporting EMPTY for calls to next and get,

endGroup

fun endGroup(): Unit

End the current group. Must be called after the corresponding startGroup.

extractKeys

fun extractKeys(): MutableList<KeyInfo>

Extract the keys from this point to the end of the group. The current is left unaffected. Must be called inside a group.

get

fun get(index: Int): Any?

Get the value stored at index in the parent group's slot.

groupAux

fun groupAux(index: Int): Any?

Get the aux data for the group at index

groupEnd

fun groupEnd(index: Int): Int

Get location of the end of the group at index.

groupGet

fun groupGet(index: Int): Any?

Get the value of the group's slot at index for the currentGroup group.

groupKey

fun groupKey(index: Int): Int

Get the key of the group at index.

groupKey

fun groupKey(anchor: Anchor): Int

Get the group key at anchor. This return 0 if the anchor is not valid.

groupObjectKey

fun groupObjectKey(index: Int): Any?

Get the object key at index.

groupSize

fun groupSize(index: Int): Int

Get the size of the group at index. Will throw an exception if index is not a group start.

hasObjectKey

fun hasObjectKey(index: Int): Boolean

Determine if the group at index has an object key

isNode

fun isNode(index: Int): Boolean

Determine if the group at index is a node.

next

fun next(): Any?

Get the value of the slot at currentGroup or EMPTY if at then end of a group. During empty mode this value is always EMPTY which is the value a newly inserted slot.

node

fun node(index: Int): Any?

Return the node at index if index is a node group else null.

nodeCount

fun nodeCount(index: Int): Int

Return the number of nodes for the group at index.

parent

fun parent(index: Int): Int

Return the parent index of index.

parentOf

fun parentOf(index: Int): Int

Return the index of the parent group of the given group

reposition

fun reposition(index: Int): Unit

Reposition the read to the group at index.

restoreParent

fun restoreParent(index: Int): Unit

Restore the parent to a parent of the current group.

skipGroup

fun skipGroup(): Int

Skip a group. Must be called at the start of a group.

skipToGroupEnd

fun skipToGroupEnd(): Unit

Skip to the end of the current group.

startGroup

fun startGroup(): Unit

Start a group.

startNode

fun startNode(): Unit

Start a group and validate it is a node group

Properties

currentEnd

var currentEnd: Int

The end of the parent group.

currentGroup

var currentGroup: Int

The current group that will be started with startGroup or skipped with skipGroup.

groupAux

val groupAux: Any?

Get the current group aux data.

groupEnd

val groupEnd: Int

Get location the end of the currently started group.

groupKey

val groupKey: Int

Get the key of the current group. Returns 0 if the currentGroup is not a group.

groupNode

val groupNode: Any?

Get the node associated with the group if there is one.

groupObjectKey

val groupObjectKey: Any?

Get the object key for the current group or null if no key was provide

groupSize

val groupSize: Int

Get the size of the group at currentGroup.

groupSlotCount

val groupSlotCount: Int

Return the number of slots allocated to the currentGroup group.

groupSlotIndex

val groupSlotIndex: Int

The group slot index is the index into the current groups slots that will be updated by read by next.

inEmpty

val inEmpty: Boolean

Determine if a beginEmpty has been called.

isGroupEnd

val isGroupEnd: Boolean

Determine if the reader is at the end of a group and an endGroup is expected.

isNode

val isNode: Boolean

Determine if the slot is start of a node.

nodeCount

val nodeCount: Int

The number of nodes managed by the current group. For node groups, this is the list of the children nodes.

parent

var parent: Int

The parent of the currentGroup group which is the last group started with startGroup.

parentNodes

val parentNodes: Int

Return the number of nodes where emitted into the current group.

size

val size: Int

Return the total number of groups in the slot table.

slot

val slot: Int

Return the current slot of the group whose value will be returned by calling next.