mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2025-07-01 15:27:58 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c2ebd5dfe4 | |||
c320411a40 |
@ -15,7 +15,7 @@ android {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.2.2"
|
||||
versionName "1.2.3"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
@ -15,7 +15,8 @@ interface ChildDeclarationInterface<T> {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @return New created TreeNode.
|
||||
*/
|
||||
@JvmSynthetic
|
||||
fun child(value: T, childDeclaration: ChildDeclaration<T>? = null)
|
||||
fun child(value: T, childDeclaration: ChildDeclaration<T>? = null): TreeNode<T>
|
||||
}
|
@ -27,11 +27,12 @@ open class TreeNode<T>(val value: T) : Iterable<TreeNode<T>>, ChildDeclarationIn
|
||||
}
|
||||
|
||||
@JvmSynthetic
|
||||
override fun child(value: T, childDeclaration: ChildDeclaration<T>?) {
|
||||
override fun child(value: T, childDeclaration: ChildDeclaration<T>?): TreeNode<T> {
|
||||
val newChild = TreeNode(value)
|
||||
if(childDeclaration != null)
|
||||
newChild.childDeclaration()
|
||||
_children.add(newChild)
|
||||
return newChild
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,20 +139,4 @@ class TreeNodeTest {
|
||||
}
|
||||
assertEquals(root.prettyString(), rootExt.prettyString())
|
||||
}
|
||||
|
||||
// @Test
|
||||
// fun getVisibleNodes() {
|
||||
// val root = tree("World") {
|
||||
// child("Level 1") {
|
||||
// child("Level 2") {
|
||||
// child("Level 3") {
|
||||
// child("Level 4")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// print(root.prettyString())
|
||||
// }
|
||||
|
||||
}
|
Reference in New Issue
Block a user