Skip to content
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

Open
wants to merge 99 commits into
base: feedback
Choose a base branch
from
Open

Feedback #1

wants to merge 99 commits into from

Conversation

github-classroom[bot]
Copy link
Contributor

@github-classroom github-classroom bot commented Mar 23, 2023

👋! 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:

  • Click the Files changed tab to see all of the changes pushed to 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”.
  • Click the Commits tab to see the commits pushed to main. Click a commit to see specific changes.
  • If you turned on autograding, then click the Checks tab to see the results.
  • This page is an overview. It shows commits, line comments, and general comments. You can leave a general comment below.
    For more information about this pull request, read “Leaving assignment feedback in GitHub”.

Subscribed: @SurfaceYellowDuck @ancavar @nemakin

github-classroom bot and others added 30 commits March 23, 2023 05:28
linter action have to run on every push and pull_request.
* 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
ancavar and others added 20 commits May 1, 2023 00:08
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>
Copy link

@Urtix Urtix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Итого: все неплохо, за исключением нескольких моментов.

Comment on lines +117 to +120
} else if (node.right == null) {
return node.left
} else {
val tmp: Self = findMax(node.left)!!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не заменили на ?: throw IllegalStateException("описание состояния")
Такой вариант использования !! приводит к непредвиденному NullPointerException.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да там просто такое чувство что ну невозможно null получить если всмотреться, все до этого проверили

Comment on lines +31 to +33
} catch (e: Exception) {
println("Write error")
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так выводить ошибку при exception не стоит.
Лучше использовать throw IllegalArgumentException("Описание ошибки")

Comment on lines +49 to +51
} catch (e: Exception) {
println("Read error")
null
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Та же проблема с выводом exception

Comment on lines +60 to +62
override fun removeTree(treeName: String) {
File("${this.folderPath}/$treeName.json").delete()
}
Copy link

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"}}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имхо, имя файла стоило другое дать, а то сначала подумал что это для каких-то тестов.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мы просто не знали как пустую папку в репозитории создать / запушить, пришлось вместе с этим пушить

@Urtix
Copy link

Urtix commented May 3, 2023

А как запускать графический интерфейс то?
image

* @return True if the string can be parsed as an integer, false otherwise.
*/

fun isNumeric(s: String): Boolean {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDigit есть у String

Copy link
Contributor

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.")
Copy link

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"
Copy link

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")
Copy link

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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AVL - аббревиатура. Должна писаться КАПСОМ

@Urtix
Copy link

Urtix commented May 3, 2023

По сравнению с предыдущим ревью все очень хорошо.
В большинстве своем читаемый код с нормальными комментами.
Жаль, что проект без докера не работает.

@Urtix
Copy link

Urtix commented May 3, 2023

image
Падает при попытке сохранить дерево без имени. Хотя и не полностью, но текст ошибки очень страшный

@Urtix
Copy link

Urtix commented May 3, 2023

image
Попытка удаления аналогично

@Urtix
Copy link

Urtix commented May 3, 2023

Нет никакой кнопочки, которая могла бы выполнять поиск по дереву.

@Urtix
Copy link

Urtix commented May 3, 2023

Если в AVL дереве именем файла указывать сколько-то "/", то они все будут удаляться и будет просто .json. В итоге AVL дерево перестанет работать.

@Urtix
Copy link

Urtix commented May 3, 2023

Если дерево уже существует и его имя указать при работе с другим, то оно перезапишется. Где предупреждение, что дерево уже существует?

@Urtix
Copy link

Urtix commented May 3, 2023

С обратными слешами в AVL такая же проблема.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants