Skip to content

Releases: lifestreamy/TreeBuilder

TreeBuilder 2.0 : Declarative building with Kotlin DSL

17 Dec 22:36
Compare
Choose a tag to compare

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("")
            }
        }

Latest Fix

24 Jan 07:41
Compare
Choose a tag to compare
v1.1

Fixed mistakes in TreeNode.clone(). Changed lines regarding nodeAttri…

1st release

18 Dec 19:47
Compare
Choose a tag to compare
v1.0

Changed several methods, now path is presented in an IntArray from a …