addApplicator

abstract fun addApplicator(canApply: (value: T) -> Boolean, apply: suspend (value: T) -> Unit, applyTimeoutMillis: Long): MimiParameterApplicator

Adds an out-of-date MimiParameterApplicator to the ProcessingParameter.

Creates and registers a MimiParameterApplicator instance to receive update requests from this ProcessingParameter.

No Parameter updates or Applicator synchronization attempts are triggered by calling this function.

Use MimiParameterApplicator.remove to permanently stop receiving updates.

Return

A strongly held reference to the new MimiParameterApplicator.

Parameters

canApply

A function which returns Boolean.true when it is expected that value will be successfully applied to this MimiParameterApplicator, otherwise Boolean.false.

apply

A suspending function which applies the value to MimiParameterApplicator. Returns Unit for a successful update or thrown an Exception if the MimiParameterApplicator could not be updated.

applyTimeoutMillis

The timeout that the ProcessingParameter should allow for updates to this MimiParameterApplicator. Updates causing the timeout to expire will be considered a failed update.


abstract suspend fun addApplicator(value: T, canApply: (value: T) -> Boolean, apply: suspend (value: T) -> Unit, applyTimeoutMillis: Long): Pair<MimiParameterApplicator, ProcessingParameterResult>

Adds an already up-to-date MimiParameterApplicator to the ProcessingParameter and triggers a call to attempt to update all other MimiParameterApplicator with that value.

Sometimes referred to as the "reverse sync".

The created MimiParameterApplicator instance will not receive an update call for the supplied value, but will receive subsequent update from the ProcessingParameter.

Return

A Pair with the new MimiParameterApplicator and a ProcessingParameterResult to indicate the result of the attempted update of the other MimiParameterApplicators to value.

Parameters

value

The value to be applied to the other MimiParameterApplicator instances.

canApply
apply
applyTimeoutMillis