Skip to content

Commit dcc1a30

Browse files
committed
refactor: more
1 parent 2d4ec8b commit dcc1a30

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

trees/src/main/kotlin/bst/RedBlackTree.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ class RedBlackTree<K : Comparable<K>, V>(@Transient val key: K? = null, @Transie
107107
val head = initNode(
108108
key,
109109
rootNode?.value
110-
?: throw IllegalStateException("Root of the tree cannot be null"))
110+
?: throw IllegalStateException("Root of the tree cannot be null")
111+
)
111112
var iter: RBTNode<K, V> = head
112113
var parent: RBTNode<K, V>? = null
113114
var grandparent: RBTNode<K, V>?
@@ -161,7 +162,7 @@ class RedBlackTree<K : Comparable<K>, V>(@Transient val key: K? = null, @Transie
161162
} else {
162163
val direction2 = (
163164
grandparent?.right
164-
?: throw IllegalStateException("Grandparent node cannot be null")
165+
?: throw IllegalStateException("Grandparent node cannot be null")
165166
) == parent
166167

167168
if (isRed(sibling.child(last))) {

trees/src/main/kotlin/bst/db/controllers/Neo4jController.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ class Neo4jController : Controller<RBTNode<Int, String>, RedBlackTree<Int, Strin
8484
val entityTree = tree.toSerializableTree(treeName).toTreeEntity()
8585
entityTree.treeName = treeName
8686
session.save(entityTree)
87-
session.query("MATCH (n: BinaryNode) WHERE NOT (n)--() DELETE (n)",
88-
mapOf<String, String>())
87+
session.query(
88+
"MATCH (n: BinaryNode) WHERE NOT (n)--() DELETE (n)",
89+
mapOf<String, String>()
90+
)
8991
}
9092

9193
override fun removeTree(treeName: String) {

trees/src/main/kotlin/bst/db/controllers/SQLController.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package bst.db.controllers
22

33
import bst.BSTree
4-
import bst.db.serializeClasses.SerializableNode
5-
import bst.db.serializeClasses.SerializableTree
6-
import bst.nodes.BSTNode
74
import bst.db.models.sql.Node
8-
import bst.db.models.sql.Trees
95
import bst.db.models.sql.Nodes
106
import bst.db.models.sql.Tree
7+
import bst.db.models.sql.Trees
8+
import bst.db.serializeClasses.SerializableNode
9+
import bst.db.serializeClasses.SerializableTree
10+
import bst.nodes.BSTNode
1111
import org.jetbrains.exposed.sql.Database
1212
import org.jetbrains.exposed.sql.SchemaUtils
1313
import org.jetbrains.exposed.sql.StdOutSqlLogger

0 commit comments

Comments
 (0)