All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.tracing.renderer.util.kt Maven / Gradle / Ivy

There is a newer version: 5.41.0.0
Show newest version
package org.http4k.tracing.renderer

import org.http4k.tracing.Actor
import org.http4k.tracing.Trace

/**
 * Returns all distinct actors in the list of Traces, so that they appear in chronological
 * order as to their position in the overall flow.
 */
fun List.chronologicalActors(): List {
    val origins = map { it.origin } + flatMap { it.children.flatMap(Trace::origins) }
    val targets = map { it.target } + flatMap { it.children.flatMap(Trace::targets) }
    return (origins + targets).distinct()
}

private fun Trace.origins(): List = listOf(origin) + children.flatMap(Trace::origins)
private fun Trace.targets(): List = listOf(target) + children.flatMap(Trace::targets)

internal fun String.identifier() = filter { it.isLetterOrDigit() }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy