Implemented and tested declarative approach with Kotlin DSL. Improved and adjusted the imperative approach.
Added more methods, fixed inconsistencies and bugs, improved logic, docs.
Adjusted project structure and moved examples to test sources. Adjusted the examples.
Check the documentation in the code for all of the information.
// See GenericMixed in the examples.
val rootL = listOf("a0", "a1", "a2", "a3")
val tree = tree {
treeName = "Generic Tree"
root {
name = "Generic Root"
attributes = listOf(1, 2, 3) // The type of the tree can be auto-inferred from this list type
}
emptyNodes(rootL)
emptyNode("Empty")
// will switch context to [Root -> index 0 child node]
atPath(0) {
emptyNodes("b0", "b1", "b2")
// will switch to 0,0
atRelativePath(0) {
emptyNodes("f0", "f1")
// will switch to 0,0,1
atRelativePath(1) {
emptyNodes("j0")
}
emptyNodes("")
}
emptyNodes("Empty1", "Empty2")
emptyNode("")
}
}