Interface IDecider<C, S, E>

IDecider represents the main decision-making algorithm. It has three generic parameters C, S, E , representing the type of the values that IDecider may contain or use. IDecider can be specialized for any type C or S or E because these types does not affect its behavior. IDecider behaves the same for C=Int or C=YourCustomType, for example.

IDecider is a pure domain interface.

Param: decide

A function/lambda that takes command of type C and input state of type S as parameters, and returns/emits the list of output events E[]>

Param: evolve

A function/lambda that takes input state of type S and input event of type E as parameters, and returns the output/new state S

Param: initialState

A starting point / An initial state of type S

Author

Иван Дугалић / Ivan Dugalic /

Idugalic

interface IDecider {
    decide: ((c, s) => readonly E[]);
    evolve: ((s, e) => S);
    initialState: S;
}

Type Parameters

  • C

    Command

  • S

    State

  • E

    Event

Hierarchy

Implemented by

Properties

decide: ((c, s) => readonly E[])

Type declaration

    • (c, s): readonly E[]
    • Parameters

      • c: C
      • s: S

      Returns readonly E[]

evolve: ((s, e) => S)

Type declaration

    • (s, e): S
    • Parameters

      • s: S
      • e: E

      Returns S

initialState: S

Generated using TypeDoc