StoreStateCallback

class StoreStateCallback<T, R>(storeValueIn: NodeParameterKey<T, R>) : StateCallback<T, R, R>

An implementation of StateCallback that stores values in the key specified in storeValueIn.

Parameters

T

The context type (see NodeParameterKey for details)

R

The type of the state

Constructors

Link copied to clipboard
constructor(storeValueIn: NodeParameterKey<T, R>)

Functions

Link copied to clipboard
fun <T, R> StateCallback<T, R, *>?.createStoreMap(value: R): Map<NodeParameterKey<T, *>, Any?>

Create a store map and evaluate this state callback. The map is returned.

Link copied to clipboard
open override fun reduceState(storage: MutableMap<NodeParameterKey<T, *>, Any?>, state: R): R

Reduce the provided state, optionally storing it in the storage.

Link copied to clipboard
fun <T, R> StateCallback<T, R, *>?.withStoreMap(value: R, currIndex: Int, handler: (Map<NodeParameterKey<T, *>, Any?>) -> ExpectationResult<T>): ExpectationResult<T>

Create a store map (using createStoreMap) and call the provided handler, returning an ExpectationResult.