Set the correct file structure to maintain backward compatibility. (#18)

This commit is contained in:
2022-12-16 19:05:59 +01:00
committed by GitHub
parent 5dd586f9af
commit ae4757fb9d
9 changed files with 10 additions and 22 deletions

View File

@@ -0,0 +1,25 @@
package com.github.adriankuta.datastructure.tree
import kotlin.jvm.JvmSynthetic
typealias ChildDeclaration<T> = ChildDeclarationInterface<T>.() -> Unit
/**
* This method can be used to initialize new tree.
* ```
* val root = tree("World") { ... }
* ```
* @param root Root element of new tree.
* @see [ChildDeclarationInterface.child]
*/
@JvmSynthetic
inline fun <reified T> tree(
root: T,
defaultIterator: TreeNodeIterators = TreeNodeIterators.PreOrder,
childDeclaration: ChildDeclaration<T>
): TreeNode<T> {
val treeNode = TreeNode(root)
treeNode.defaultIterator = defaultIterator
treeNode.childDeclaration()
return treeNode
}