DataTree

@DfId(id = "dataTree")
interface DataTree<out T : Any> : DataSet<T>

A tree-like DataSet grouped into the node. All data inside the node must inherit its type

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val dataType: KType

The minimal common ancestor to all data in the node

Link copied to clipboard
abstract val items: Map<NameToken, DataTreeItem<T>>

Top-level children items of this DataTree

Link copied to clipboard
open override val meta: Meta

Meta-data associated with this node. If no meta is provided, returns Meta.EMPTY.

Link copied to clipboard
val <T : Any> DataSet<T>.updates: Flow<Name>
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : Any> DataSet<T>.branch(branchName: String): DataSet<T>
fun <T : Any> DataTree<T>.branch(branchName: String): DataTree<T>

fun <T : Any> DataSet<T>.branch(branchName: Name): DataSet<T>

Get a subset of data starting with a given branchName

fun <T : Any> DataTree<T>.branch(branchName: Name): DataTree<T>

Get a branch of this DataTree with a given branchName. The difference from similar method for DataSet is that internal logic is more simple and the return value is a DataTree

Link copied to clipboard
suspend fun <T : Any> DataSet<T>.computeAndJoinAll()
Link copied to clipboard
fun <T : Any> DataSet<T>.filter(predicate: (Name, Meta) -> Boolean): DataSource<T>

A stateless filtered DataSet

Link copied to clipboard
inline fun <R : Any> DataSet<*>.filterByType(noinline predicate: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }): DataSet<R>

Select a single datum of the appropriate type

fun <R : Any> DataSet<*>.filterByType(type: KType, predicate: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }): DataSource<R>

Select all data matching given type and filters. Does not modify paths

Link copied to clipboard
inline fun <T : Any, R : Any> DataSet<T>.foldToData(initial: R, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline block: suspend (result: R, data: NamedValueWithMeta<T>) -> R): Data<R>
Link copied to clipboard
inline fun <T : Any> DataSet<T>.forEach(block: (NamedData<T>) -> Unit)
Link copied to clipboard
open operator override fun get(name: Name): Data<T>?

Get data with given name.

Link copied to clipboard
operator fun <T : Any> DataSet<T>.get(name: String): Data<T>?
Link copied to clipboard
inline fun <R : Any> DataSet<*>.getByType(name: String): NamedData<R>?
inline fun <R : Any> DataSet<*>.getByType(name: Name): NamedData<R>?

fun <R : Any> DataSet<*>.getByType(type: KType, name: Name): NamedData<R>?

Select a single datum if it is present and of given type

Link copied to clipboard
tailrec fun <T : Any> DataTree<T>.getItem(name: Name): DataTreeItem<T>?

Get a DataTreeItem with given name or null if the item does not exist

Link copied to clipboard
open operator override fun iterator(): Iterator<NamedData<T>>

Traverse this DataSet returning named data instances. The order is not guaranteed.

Link copied to clipboard
fun <T : Any> DataTree<T>.listChildren(prefix: Name): List<Name>
Link copied to clipboard
inline suspend fun <T : Any, R : Any> DataSet<T>.map(coroutineContext: CoroutineContext = EmptyCoroutineContext, noinline metaTransform: MutableMeta.() -> Unit = {}, noinline block: suspend (NamedValueWithMeta<T>) -> R): DataTree<R>
suspend fun <T : Any, R : Any> DataSet<T>.map(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, metaTransform: MutableMeta.() -> Unit = {}, block: suspend (NamedValueWithMeta<T>) -> R): DataTree<R>
Link copied to clipboard
inline fun <T : Any, R : Any> DataSet<T>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline transformation: suspend (Iterable<NamedValueWithMeta<T>>) -> R): Data<R>
Link copied to clipboard
suspend fun <T : Any> DataSet<T>.rootData(): Data<T>?
Link copied to clipboard
fun <T : Any> DataSet<T>.seal(): DataTree<T>
Link copied to clipboard
fun <T : Any> DataSet<T>.single(): NamedData<T>

Return a single Data in this DataSet. Throw error if it is not single.

Link copied to clipboard
fun <T : Any> DataSet<T>.startAll(coroutineScope: CoroutineScope): Job

Start computation for all goals in data node and return a job for the whole node

Link copied to clipboard
fun DataSet<*>.toMeta(): Meta
Link copied to clipboard

A Sequence of all children including nodes

Link copied to clipboard
fun <T : Any> DataSet<T>.withNamePrefix(prefix: Name): DataSet<T>

Generate a wrapper data set with a given name prefix appended to all names