You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
400 B
Kotlin
17 lines
400 B
Kotlin
package wf.servitor.common.workflow
|
|
|
|
import java.io.Serializable
|
|
|
|
data class Flow(val steps: List<Step> = listOf()) : Serializable {
|
|
fun getStep(path: List<Int>): Step? {
|
|
if (path.isEmpty()) {
|
|
return null
|
|
}
|
|
|
|
return path
|
|
.drop(1)
|
|
.fold(steps.getOrNull(path.first())) { s, index ->
|
|
s?.getChild(index)
|
|
}
|
|
}
|
|
} |