Join us for ⁠#Android11: The Beta Launch Show on June 3!

SlotReader

class SlotReader
kotlin.Any
   ↳ androidx.compose.SlotReader

Summary

Public constructors

<init>(table: SlotTable)

Public methods

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.

Unit

End a node

MutableList<KeyInfo>

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

Any?
get(anchor: Anchor)

Get the value stored at anchor.

Any?
get(index: Int)

Get the value stored at index.

Int
groupEnd(index: Int)

Get location of the end of the group at index.

Any
groupKey(index: Int)

Get the key of the group at index.

Int
groupSize(index: Int)

Get the size of the group at index.

Boolean
isGroup(index: Int)

Determine if the slot at index is the start of a group

Boolean
isNode(location: Int)

Determine if the slot at location is a node group.

Any?

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

Unit
reposition(value: Int)

Int

Skip a group.

Int

Start a node.

Unit

Skip to the end of the current group.

Unit

Start a group.

Unit
startNode(key: Any)

Start a node.

String

Properties

Int

Int

Any?

Get the data for the current group.

Int

Get location the end of the currently started group.

Any

Get the key of the current group.

Any?

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

Int

Get the size of the group at current.

Boolean

Determine if a beginEmpty has been called.

Boolean

Determine the slot at current is the start of a group and not at the end of the current group.

Boolean

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

Boolean

Determine if the slot is start of a node.

Int

Int

Return the location of the parent group of the current

Int

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

Int

Return the number of slots are in the current group.

SlotTable

Public constructors

<init>

SlotReader(table: SlotTable)

Public methods

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.

endNode

fun endNode(): Unit

End a node

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(anchor: Anchor): Any?

Get the value stored at anchor.

get

fun get(index: Int): Any?

Get the value stored at index.

groupEnd

fun groupEnd(index: Int): Int

Get location of the end of the group at index.

groupKey

fun groupKey(index: Int): Any

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

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.

isGroup

fun isGroup(index: Int): Boolean

Determine if the slot at index is the start of a group

isNode

fun isNode(location: Int): Boolean

Determine if the slot at location is a node group. This will throw if the slot at location is not a node.

next

fun next(): Any?

Get the value of the slot at current 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.

reposition

fun reposition(value: Int): Unit

skipGroup

fun skipGroup(): Int

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

skipNode

fun skipNode(): Int

Start a node.

skipToGroupEnd

fun skipToGroupEnd(): Unit

Skip to the end of the current group.

startGroup

fun startGroup(key: Any): Unit

Start a group. Passing an EMPTY as the key will enter the group without validating the key.

startNode

fun startNode(key: Any): Unit

Start a node.

toString

fun toString(): String

Properties

current

var current: Int

currentEnd

var currentEnd: Int

groupData

val groupData: Any?

Get the data for the current group. Returns null if current is not a group

groupEnd

val groupEnd: Int

Get location the end of the currently started group.

groupKey

val groupKey: Any

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

groupNode

val groupNode: Any?

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

groupSize

val groupSize: Int

Get the size of the group at current. Will throw an exception if the isGroup is false.

inEmpty

val inEmpty: Boolean

Determine if a beginEmpty has been called.

isGroup

val isGroup: Boolean

Determine the slot at current is the start of a group and not at the end of the current group.

isGroupEnd

val isGroupEnd: Boolean

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

isNode

val isNode: Boolean

Determine if the slot is start of a node.

nodeIndex

var nodeIndex: Int

parentLocation

val parentLocation: Int

Return the location of the parent group of the current

parentNodes

val parentNodes: Int

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

parentSlots

val parentSlots: Int

Return the number of slots are in the current group.

table

val table: SlotTable