State

class State(initialState: Map<String, Any> = emptyMap(), initialDelta: Map<String, Any> = emptyMap()) : Map<String, Any>

A thread-safe state map that maintains the current value and tracks modifications.

This class implements Map to provide a read-only view of the state, while exposing specific mutation methods (set, putAll).

Constructors

Link copied to clipboard
constructor(initialState: Map<String, Any> = emptyMap(), initialDelta: Map<String, Any> = emptyMap())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val entries: Set<Map.Entry<String, Any>>
Link copied to clipboard

Whether the state has pending delta.

Link copied to clipboard
open override val keys: Set<String>
Link copied to clipboard
open override val size: Int
Link copied to clipboard
open override val values: Collection<Any>

Functions

Link copied to clipboard
fun applyDelta(delta: Map<String, Any>)

Applies the non-temp: entries of delta to the state, tracking them in the delta map.

Link copied to clipboard

Applies only the temp:-prefixed entries of delta to the state, tracking them in the delta map; the complement of applyDelta.

Link copied to clipboard
fun clear()

Clears the state and delta maps.

Link copied to clipboard
open override fun containsKey(key: String): Boolean
Link copied to clipboard
open override fun containsValue(value: Any): Boolean
Link copied to clipboard
open operator override fun get(key: String): Any?
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
fun putAll(from: Map<out String, Any>)

Updates the state with all entries from the given map.

Link copied to clipboard
fun remove(key: String): Any?
Link copied to clipboard
operator fun set(key: String, value: Any): Any?

Sets the value for the given key.

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