conditionalFanOut
fun conditionalFanOut(from: NodeRef, targets: Set<NodeRef>, labels: Map<NodeRef, String> = emptyMap(), condition: suspend (State) -> Set<NodeRef>)
Adds a conditional edge that can fan out: after from finishes, condition picks any of targets, and they run in parallel in the next step, like the targets of static edges from one node. See compile for when that needs a Reducer.
conditionalFanOut(brief, targets = setOf(locate, guide, map)) { trip ->
if (trip.located) setOf(guide, map) else setOf(locate)
}Content copied to clipboard
NodeRef.END in the result ends this branch while the other nodes run. An empty result ends the branch too. labels are as for conditionalEdge.
fun conditionalFanOut(from: String, targets: Set<NodeRef>, labels: Map<NodeRef, String> = emptyMap(), condition: suspend (State) -> Set<NodeRef>)
Adds a conditional edge that can fan out from the node named from, usually START. See the overload taking a node reference.