SlotReader
class SlotReader
kotlin.Any | |
↳ | androidx.compose.runtime.SlotReader |
A reader of a slot table. See SlotTable
Summary
Public constructors | |
---|---|
A reader of a slot table. |
Public methods | |
---|---|
Anchor |
Create an anchor to the current reader location or index. |
Unit |
Begin reporting empty for all calls to next() or get(). |
Unit |
close() Close the slot reader. |
Unit |
endEmpty() |
Unit |
endGroup() End the current group. |
MutableList<KeyInfo> |
Extract the keys from this point to the end of the group. |
Any? |
Get the value stored at index in the parent group's slot. |
Any? |
Get the aux data for the group at index |
Int |
Get location of the end of the group at index. |
Any? |
Get the value of the group's slot at index for the currentGroup group. |
Int |
Get the key of the group at index. |
Int |
Get the group key at anchor. |
Any? |
groupObjectKey(index: Int) Get the object key at 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 |
Determine if the group at index is a node. |
Any? |
next() Get the value of the slot at currentGroup or EMPTY if at then end of a group. |
Any? |
Return the node at index if index is a node group else null. |
Int |
Return the number of nodes for the group at index. |
Int |
Return the parent index of 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 |
restoreParent(index: Int) 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
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.
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.
groupGet
fun groupGet(index: Int): Any?
Get the value of the group's slot at index for the currentGroup group.
groupKey
fun groupKey(anchor: Anchor): Int
Get the group key at anchor. This return 0 if the anchor is not valid.
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
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.
restoreParent
fun restoreParent(index: Int): Unit
Restore the parent to a parent of the current group.
Properties
currentGroup
var currentGroup: Int
The current group that will be started with startGroup or skipped with skipGroup.
groupKey
val groupKey: Int
Get the key of the current group. Returns 0 if the currentGroup is not a group.
groupObjectKey
val groupObjectKey: Any?
Get the object key for the current group or null if no key was provide
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.
isGroupEnd
val isGroupEnd: Boolean
Determine if the reader is at the end of a group and an endGroup is expected.
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.