mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2025-07-01 07:17:59 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
3c3d418aa2 | |||
f00ab975dc |
@ -15,7 +15,7 @@ android {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.2.1"
|
||||
versionName "1.2.2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
@ -27,7 +27,7 @@ open class TreeNode<T>(val value: T) : Iterable<TreeNode<T>>, ChildDeclarationIn
|
||||
}
|
||||
|
||||
@JvmSynthetic
|
||||
override fun child(child: T, childDeclaration: ChildDeclaration<T>?) {
|
||||
override fun child(value: T, childDeclaration: ChildDeclaration<T>?) {
|
||||
val newChild = TreeNode(value)
|
||||
if(childDeclaration != null)
|
||||
newChild.childDeclaration()
|
||||
|
@ -128,18 +128,31 @@ class TreeNodeTest {
|
||||
europe.addChild(poland)
|
||||
europe.addChild(france)
|
||||
|
||||
val rootExt = treeNode("World") {
|
||||
treeNode("North America") {
|
||||
treeNode("USA")
|
||||
val rootExt = tree("World") {
|
||||
child("North America") {
|
||||
child("USA")
|
||||
}
|
||||
treeNode("Europe") {
|
||||
treeNode("Poland")
|
||||
treeNode("France")
|
||||
child("Europe") {
|
||||
child("Poland")
|
||||
child("France")
|
||||
}
|
||||
}
|
||||
println(root)
|
||||
assertEquals(root.toString(), rootExt.toString())
|
||||
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