Skip to content

Commit

Permalink
refactor: 💡 function behavior should match its name
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanonymous-GitHub committed Aug 21, 2024
1 parent 405e659 commit d4b6e95
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/kotlin/tw/xcc/gumtree/model/GumTreeView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ class GumTreeView private constructor(target: GumTree) : GumTree(target.info.cop
companion object {
fun from(gumTree: GumTree): GumTreeView = GumTreeView(gumTree)

fun frozeEntireTreeFrom(gumTree: GumTree): GumTreeView = gumTree.toNewFrozen()
/**
* Convert the whole tree of the subtree [gumTree] to a new frozen tree.
* Note that the returned tree is the root of the entire tree, not the [gumTree]'s view.
* */
fun frozeEntireTreeFrom(gumTree: GumTree): GumTreeView {
val root = gumTree.ancestors.lastOrNull() ?: gumTree.toNewFrozen()
return root.toNewFrozen()
}
}
}

0 comments on commit d4b6e95

Please sign in to comment.