TreeState

abstract class TreeState<F : CopySortIdFlat<F>, C : Created, U : Updated, D : Deleted, M : Moved> : ITreeState<F>

The state of a Tree: its nodes as flat Fs. Subclass it with the concrete events (C, U, D, M) and toFlat; the compiler binds the sourcing functions declared here with the subclass's type arguments:

class CategoryState(override val id: String) :
TreeState<FlatCategory, CategoryCreated, CategoryUpdated, CategoryDeleted, CategoryMoved>() {
override fun Flat.toFlat(): FlatCategory = FlatCategory(name, code, sortId)
}

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val children: SortedSet<F>

Functions

Link copied to clipboard
open fun onCreated(event: C)
Link copied to clipboard
open fun onDeleted(event: D)
Link copied to clipboard
open fun onMoved(event: M)
Link copied to clipboard
open fun onUpdated(event: U)