Collektive

class Collektive<ID : Any, R>(val localId: ID, network: Network<ID>, computeFunction: Aggregate<ID>.() -> R)

Create a Collektive device with a specific localId and a network to manage incoming and outgoing messages, the computeFunction is the function to apply within the AggregateContext.

Constructors

Link copied to clipboard
constructor(localId: ID, network: Network<ID>, computeFunction: Aggregate<ID>.() -> R)

Types

Link copied to clipboard
object Companion

Global entry points.

Properties

Link copied to clipboard
val localId: ID
Link copied to clipboard

The State of the Collektive device.

Functions

Link copied to clipboard
fun cycle(): R

Apply once the aggregate function to the parameters of the device, then returns the result of the computation.

Link copied to clipboard
fun cycleWhile(condition: (AggregateResult<ID, R>) -> Boolean): R

Apply the aggregate function to the parameters of the device while the condition is satisfied, then returns the result of the computation.