-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback #1
base: feedback
Are you sure you want to change the base?
Feedback #1
Conversation
linter action have to run on every push and pull_request.
Revert "Red black"
Red black в dev
…rom any derived tree
* feat: Add AVL tree with own BST implementation
* Create LICENSE * fix: change insert method * fix: change tests * repo: add CI * feat: implement remove method and test for it
Co-authored-by: Nikita Lukonenko <68463602+surfaceyellowduck@users.noreply.github.com>
* ci: build on multiple os, remove redundant cache * refactor: better build.gradle.kts code style * ci: Add dependabot * fix: remove debugging tools * fix: change color of RBT node to enum type * fix: Make methods for rotation abstract, fix flaky AVL test with shuffling values and other minor fixes... * implemented saving data to sqlite db * feat: implemented reading tree object from sqlite database * feat:add docker compose for lift postgresql db and small fixes * fix: Rework tree deserialization logic * add bat, sh files to up docker container * add .gitignore * fix: rework neo4j interaction * fix: null safety * fix:remove the db files in folders * fix warning associated with sf4j * feat: Initialize dependencies for UI * fix readme and add setName method to all trees * fix:fix readme * feat: add the functionality of switching between views for different trees * feat: Add the display of the binary search tree, add the ability to insert a node and clear the tree. * feat: add mapping trees list from database * Add display of the tree to choose from the list * feat: Add deletion of BST from DB and list of trees by click, little trees refactoring * add ability to save bst in db with gui * feat: add ability to delete node * fix: fix a bug related to the fact that tables were not created when starting the application * feat: Add the ability to draw an AVl tree and work with it through the graphical interface * feat: Add RBTree visualization with ability to interact with Neo4j DB * feat: better text positioning * fix: fix build on mac * feat: add tooltip to show value * feat: add tree resizing when resizing app's window * refactor * fix: setup java 11 before building * fix: review code * fix: removed space in app/build.gradle.kts * add example gif for readme * fix:add link to gif in readme * chore: add comments to bst structure * chore: Add comments for DB controllers * fix: fix linter errors * fix: fix linter errors * chore: Add more comments to DB related stuff * feat: Add ability to draw colored nodes in RBTree * chore: add comments for app * fix: fix linter errors * fix: fix linter error * fix: Remove bug when error doesn't appear after inserting empty value twice * feat: add panning * feat: restrict resizing of window's app * fix: remove scrollbar * fix: remove unnecessary border * add json folder --------- Co-authored-by: Nikita Nemakin <nikita.nemakin@yandex.ru> Co-authored-by: SurfaceYellowDuck <lukonenko.nikitka@mail.ru>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Итого: все неплохо, за исключением нескольких моментов.
} else if (node.right == null) { | ||
return node.left | ||
} else { | ||
val tmp: Self = findMax(node.left)!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не заменили на ?: throw IllegalStateException("описание состояния")
Такой вариант использования !! приводит к непредвиденному NullPointerException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
да там просто такое чувство что ну невозможно null получить если всмотреться, все до этого проверили
} catch (e: Exception) { | ||
println("Write error") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так выводить ошибку при exception не стоит.
Лучше использовать throw IllegalArgumentException("Описание ошибки")
} catch (e: Exception) { | ||
println("Read error") | ||
null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Та же проблема с выводом exception
override fun removeTree(treeName: String) { | ||
File("${this.folderPath}/$treeName.json").delete() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут бы тоже не помешала проверка на exeption.
@@ -0,0 +1 @@ | |||
{"treeName":"","rootNode":{"height":2,"key":234,"value":"gfh","left":{"height":1,"key":23,"value":"","right":{"height":0,"key":67,"value":"dgfh"}},"right":{"height":0,"key":324,"value":"fdsg"}}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Имхо, имя файла стоило другое дать, а то сначала подумал что это для каких-то тестов.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мы просто не знали как пустую папку в репозитории создать / запушить, пришлось вместе с этим пушить
* @return True if the string can be parsed as an integer, false otherwise. | ||
*/ | ||
|
||
fun isNumeric(s: String): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDigit есть у String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDigit помоему у Char, но в целом метод можно было красивее написать, согласен
if (root != null) { | ||
drawNode(root, treePane, treePane.width / 2.0, treePane.width / 2.0, 250.0) | ||
} else { | ||
throw NullPointerException("Root of the tree is null.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
То есть приложение просто упадет, если какая-то внутренняя ошибка произойдет. Не очень user friendly. Наверное, если рут налл, то можно ничего не делать. Как вам идея?
/** | ||
* The path to the folder where JSON files are stored. | ||
*/ | ||
val folderPath = "json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если очень хочу сохранить куда-то на компьютер? Бтв, неясно какая будет в итоге локация у файла после превращения в исполняемый файл
*/ | ||
private val config = Configuration.Builder() | ||
.uri("bolt://localhost") | ||
.credentials("neo4j", "password") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хочу другой neo4j использовать, например в вебе. Как мне это сделать? Кстати, это ломает приложение при запуске, если у пользователя не поднят докер с нужными портами. Очень странно, если хочется только json
import org.junit.jupiter.api.Test | ||
import kotlin.math.max | ||
|
||
class AvlTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AVL - аббревиатура. Должна писаться КАПСОМ
По сравнению с предыдущим ревью все очень хорошо. |
Нет никакой кнопочки, которая могла бы выполнять поиск по дереву. |
Если в AVL дереве именем файла указывать сколько-то "/", то они все будут удаляться и будет просто .json. В итоге AVL дерево перестанет работать. |
Если дерево уже существует и его имя указать при работе с другим, то оно перезапишется. Где предупреждение, что дерево уже существует? |
С обратными слешами в AVL такая же проблема. |
👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to
main
since the assignment started. Your teacher can see this too.Notes for teachers
Use this PR to leave feedback. Here are some tips:
main
since the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue + (plus sign). To learn more about comments, read “Commenting on a pull request”.main
. Click a commit to see specific changes.For more information about this pull request, read “Leaving assignment feedback in GitHub”.
Subscribed: @SurfaceYellowDuck @ancavar @nemakin