mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2026-06-20 03:10:14 +02:00
BREAKING changes to the core: - treeIterator is now a read-only `val`; added `iterator(order)` and use `asSequence(order)`. - removeChild() only removes a direct child of the receiver; added `detach()` to unhook a node. - addChild() rejects re-parenting and cycles (throws TreeNodeException); detach() first to move. - clear() no longer nulls the receiver's own parent; only removes descendants. - path() returns List<TreeNode<T>>? (null) instead of throwing. Also: - Enable strict explicitApi() across core + both modules; add explicit `public` modifiers. - Update tests for the new contracts + add TreeNodeV4Test; refresh .api baselines. - README + CHANGELOG (with migration notes); bump version to 4.0.0. 47 JVM tests green.
24 lines
600 B
Kotlin
24 lines
600 B
Kotlin
package com.github.adriankuta.datastructure.tree
|
|
|
|
import kotlin.jvm.JvmSynthetic
|
|
|
|
public interface ChildDeclarationInterface<T> {
|
|
|
|
/**
|
|
* This method is used to easily create child in node.
|
|
* ```
|
|
* val root = tree("World") {
|
|
* child("North America") {
|
|
* child("USA")
|
|
* }
|
|
* child("Europe") {
|
|
* child("Poland")
|
|
* child("Germany")
|
|
* }
|
|
* }
|
|
* ```
|
|
* @return New created TreeNode.
|
|
*/
|
|
@JvmSynthetic
|
|
public fun child(value: T, childDeclaration: ChildDeclaration<T>? = null): TreeNode<T>
|
|
} |