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
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
c684c27
Setting up GitHub Classroom Feedback
github-classroom[bot] Mar 23, 2023
2440aca
chore: Add .gitignore
nemakin Mar 27, 2023
3a6e826
chore: Set up project structure
nemakin Mar 27, 2023
551bf1b
fix(repo): Delete .idea dir and add proper .gitignore
nemakin Mar 27, 2023
4a156c0
feat(repo): add general project structure
ancavar Mar 27, 2023
d64f79b
Create linter action
SurfaceYellowDuck Mar 28, 2023
f77fa40
feat: add BalancingTree class
ancavar Mar 28, 2023
04961ce
add insert method and private recursiveInsert method to BinarySearchT…
SurfaceYellowDuck Mar 28, 2023
1c09271
add find method and private search method is BinarySearchTree class
SurfaceYellowDuck Mar 28, 2023
1c58d50
feat: implement rotations in BalancingTree
ancavar Mar 28, 2023
095a1f3
feat: implement insert method
ancavar Mar 28, 2023
4ce4b0b
refactor: remove overriding find and clear method as we are inheritin…
ancavar Mar 29, 2023
4e46238
Merge pull request #2 from spbu-coding-2022/BST
ancavar Mar 29, 2023
81095ba
fix: remove redundant value parameter from remove method
ancavar Mar 29, 2023
5779c31
feat: test template for RBT
ancavar Mar 29, 2023
18d2f20
refactor: major refactoring according to linter
ancavar Mar 29, 2023
bec9900
refactor: minor refactoring
ancavar Mar 29, 2023
6f0866a
Merge pull request #3 from spbu-coding-2022/red-black
ancavar Mar 29, 2023
d70caab
Revert "Red black"
ancavar Mar 29, 2023
fb4350f
Merge pull request #4 from spbu-coding-2022/revert-3-red-black
ancavar Mar 29, 2023
eb6ba6e
Merge branch 'dev' into red-black
ancavar Mar 29, 2023
1d6ea04
Merge pull request #5 from spbu-coding-2022/red-black
ancavar Mar 29, 2023
5314ceb
fix: remove value parameter from Tree interface
ancavar Mar 29, 2023
2006ec6
fix: change search function to protected and so that it can be used f…
ancavar Mar 29, 2023
391e531
Create README.md
SurfaceYellowDuck Mar 31, 2023
cf8e545
Implement AVL tree (#6)
nemakin Apr 4, 2023
ac0da2c
feat: implement better red-black tree methods and tests for it
ancavar Apr 4, 2023
54913ce
fix: band-aid fix for removal
ancavar Apr 4, 2023
ab4e10d
Delete .idea directory
SurfaceYellowDuck Apr 6, 2023
c95cf57
add readme from main
SurfaceYellowDuck Apr 6, 2023
926994c
Merge remote-tracking branch 'origin/dev' into dev
SurfaceYellowDuck Apr 6, 2023
860f2c4
resolve conflict main and dev branches
SurfaceYellowDuck Apr 6, 2023
18fcb15
resolve merge conflict(added missing files)
SurfaceYellowDuck Apr 6, 2023
9b79a9f
feat: Add test on tree creation and write auxiliary methods for futhe…
nemakin Apr 7, 2023
2da358f
feat: Add basic tests on insertions
nemakin Apr 7, 2023
29fd243
feat: Add tests on insertions causing rotations
nemakin Apr 7, 2023
0bb9a28
feat: Add tests on finding elements
nemakin Apr 7, 2023
97f5e9c
feat: Add some tests on deletions
nemakin Apr 7, 2023
de7d352
fix: incorrect deletion by not copying node key and value
ancavar Apr 15, 2023
a9cd189
feat: more quality tests
ancavar Apr 15, 2023
40c6bf0
ci: implement JaCoCo
ancavar Apr 15, 2023
eb5bd20
feat: add tests for BST
ancavar Apr 15, 2023
840d256
Merge pull request #9 from spbu-coding-2022/dev
ancavar Apr 16, 2023
67f1beb
fix: change assertion calls to safe
ancavar Apr 17, 2023
209197e
fix: new faster linter, remove gradle test
ancavar Apr 18, 2023
b811a9d
refaсtor: general refactoring
ancavar Apr 18, 2023
36b408e
repo: add basic README.md
ancavar Apr 19, 2023
2dd00ac
db: initial commit for neo4j
ancavar Apr 17, 2023
439eff7
db: change name to property of a tree
ancavar Apr 19, 2023
8504510
fix: change assertion calls to safe
ancavar Apr 17, 2023
49235b4
fix: new faster linter, remove gradle test
ancavar Apr 18, 2023
85c0f1a
refaсtor: general refactoring
ancavar Apr 18, 2023
bcc69b3
repo: add basic README.md
ancavar Apr 19, 2023
dca9235
Merge branch 'main' into neo4j
ancavar Apr 19, 2023
5decda6
Merge pull request #12 from spbu-coding-2022/neo4j
ancavar Apr 19, 2023
9edffc9
Add x, y coordinates to nodes
SurfaceYellowDuck Apr 19, 2023
8965444
Merge pull request #13 from spbu-coding-2022/BST
SurfaceYellowDuck Apr 19, 2023
8c7a31c
Merge branch 'main' into dev
SurfaceYellowDuck Apr 19, 2023
62a655e
db: initial commit for neo4j
ancavar Apr 17, 2023
4a973be
db: change name to property of a tree
ancavar Apr 19, 2023
6f2f97d
Add x, y coordinates to nodes
SurfaceYellowDuck Apr 19, 2023
06e414b
resolving conflicts
SurfaceYellowDuck Apr 19, 2023
54d2d1e
fix after resolve in BST
SurfaceYellowDuck Apr 19, 2023
8499471
Merge branch 'dev' into BST
SurfaceYellowDuck Apr 19, 2023
733bdc0
Merge pull request #15 from spbu-coding-2022/BST
SurfaceYellowDuck Apr 19, 2023
893ff31
Merge pull request #14 from spbu-coding-2022/dev
SurfaceYellowDuck Apr 19, 2023
6ee14b3
ci: build on multiple os, remove redundant cache
ancavar Apr 21, 2023
42d906a
refactor: better build.gradle.kts code style
ancavar Apr 21, 2023
f85d29a
ci: Add dependabot
ancavar Apr 21, 2023
d613138
fix: remove debugging tools
ancavar Apr 22, 2023
e4c8de2
fix: change color of RBT node to enum type
ancavar Apr 22, 2023
b102436
fix: Make methods for rotation abstract, fix flaky AVL test with shuf…
nemakin Apr 22, 2023
9df571c
implemented saving data to sqlite db
SurfaceYellowDuck Apr 23, 2023
6f47c8e
feat: implemented reading tree object from sqlite database
SurfaceYellowDuck Apr 24, 2023
6e769bf
feat:add docker compose for lift postgresql db and small fixes
SurfaceYellowDuck Apr 24, 2023
cf5d1f3
fix: Rework tree deserialization logic
SurfaceYellowDuck Apr 25, 2023
6ba1546
add bat, sh files to up docker container
SurfaceYellowDuck Apr 25, 2023
dab9995
add .gitignore
SurfaceYellowDuck Apr 25, 2023
25a6fb2
fix: rework neo4j interaction
ancavar Apr 25, 2023
4df2204
fix: null safety
ancavar Apr 25, 2023
0ee304e
fix:remove the db files in folders
SurfaceYellowDuck Apr 25, 2023
737623c
fix warning associated with sf4j
SurfaceYellowDuck Apr 25, 2023
ad89890
refactor: better test names, remove debugging info
ancavar Apr 25, 2023
10ad5bb
feat: add logger to neo4j
ancavar Apr 25, 2023
4a940a4
refactor: ctrl+shift+alt+l all files
ancavar Apr 25, 2023
fc1ba27
fix readme and add setName method to all trees
SurfaceYellowDuck Apr 26, 2023
05bc89f
refactor: better README.md
ancavar Apr 26, 2023
fa8124e
feat: bring back markdown linter
ancavar Apr 26, 2023
d764fe0
feat: add neo4j to docker-compose.yml
ancavar Apr 26, 2023
b44b5d7
feat: add test coverage reports back
ancavar Apr 26, 2023
6d0f73b
fix: typos in README.md
ancavar Apr 27, 2023
1438bcd
fix: better names, remove unnecessary cast
ancavar Apr 28, 2023
cb8506b
feat: implement Controller interface, add removal to JSON
ancavar Apr 28, 2023
f8c9dfd
fix: improve linter
ancavar Apr 28, 2023
50f9f7c
fix: remove setName usage
ancavar Apr 28, 2023
e270336
feat: add close session method
ancavar Apr 30, 2023
2d4ec8b
refactor
ancavar Apr 30, 2023
dcc1a30
refactor: more
ancavar Apr 30, 2023
d7668de
Implement user interface in application for drawing tree. (#22)
ancavar May 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint Codebase

on:
push:
pull_request:

jobs:
run-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter/slim@v5
env:
VALIDATE_JSCPD: false
VALIDATE_MARKDOWN: false
VALIDATE_KOTLIN_ANDROID: false
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: "main"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test with coverage
on:
push:
pull_request:
jobs:
build:
name: Build and Run Tests
runs-on: ubuntu-latest
ancavar marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew build
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle
ancavar marked this conversation as resolved.
Show resolved Hide resolved
- name: JaCoCo Coverage Report
env:
report_path: trees/build/jacoco/report.csv
run: |
awk -F"," '{ instructions += $4 + $5; covered += $5; branches += $6 + $7; branches_covered +=$7 } END { print "Instructions covered:", covered"/"instructions, "--", 100*covered/instructions"%"; print "Branches covered:", branches_covered"/"branches, "--", 100*branches_covered/branches"%" }' $report_path
- uses: actions/upload-artifact@v3
with:
name: test-and-coverage-reports
path: trees/build/reports
retention-days: 365
- name: Cleanup Gradle Cache

# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Trees library.
> An open source library written in Kotlin to work with data structures such as AVL tree, red-black tree, and binary search tree..
## 🖍 Used technology
![Kotlin](https://img.shields.io/badge/-Kotlin-61DAFB?logo=kotlin)
![Junit](https://img.shields.io/badge/-Junit-525A162?&style=for-the-badge)
## :package: Getting started
Firstly, you need to clone repository

```sh
https://github.com/spbu-coding-2022/trees-3.git

Choose a reason for hiding this comment

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

Suggested change
https://github.com/spbu-coding-2022/trees-3.git
git clone https://github.com/spbu-coding-2022/trees-3.git

```
To build the library run

```sh
./gradlew build
```
## Using BinarySearchTree
Any `Comparable` data can be stored in trees.
You can start from create bst by:

```kotlin
import bst.BSTree
val test_data = BSTree("121", "dgs", "tree_1")
//also we support add and remove elements from bst. You can do this by:
test_data.insert("110", "dafad")
test_data.insert("118", "adfaf")
test_data.insert("124", "fggsg")
```

find or remove element from tree:
```kotlin
test_data.remove("124")
test_data.find("118")
```
Same operations support RBT and AVL trees.


BinarySearchTree supports save tree object to json file, and up tree from json.
For example:
```kotlin
test_data.saveTreeToJson()
readFromJson("tree_1.json")
```

Choose a reason for hiding this comment

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

Из документации не очевидно, чем является saveToJson и как определяется то, под каким названием сохраняется файл. Если исходя из последнего параметра класса BSTree, то, вероятно, вы хотите разделить функциональность сохранения во внешние хранилища от конкретного способа представить дерево. Это обеспечит более слабую связанность компонентов.


In development saving nodes to databases: neo4j and sql.

To save BST in SQL database we propose you to use models in directory main/db.
for example:
```kotlin
val treeObj = Tree.new {
name = "Tree_1"
}
val rootNode = Node.new {
key = "test"
value = "234"
tree = treeObj
}
treeObj.rootNode = rootNode

Choose a reason for hiding this comment

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

Судя по документации предполагается, что пользователь моделей имеет полный доступ к таблицам.
Возможно стоит ограничить доступ к Entities базы данных через функции.
Например, производить создание row в таблице только по name и переданному дереву.

```

## Storing BSTs
`bst` provides

Choose a reason for hiding this comment

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

Что предоставляет bst?

Binary file added app/.DS_Store
Binary file not shown.
32 changes: 32 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.8.10"
ancavar marked this conversation as resolved.
Show resolved Hide resolved

// Apply the application plugin to add support for building a CLI application in Java.
application
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

dependencies {
// Use the Kotlin JUnit 5 integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")

// Use the JUnit 5 integration.
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.2")
ancavar marked this conversation as resolved.
Show resolved Hide resolved

implementation(project(":trees"))
}

application {
// Define the main class for the application.
mainClass.set("app.AppKt")
}

tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
Binary file added app/src/.DS_Store

Choose a reason for hiding this comment

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

Все файлы с таким названием мусор из macos. Им не место в репозитории. Обновите .gitignore добавив .DS_Store

Binary file not shown.
Binary file added app/src/main/.DS_Store
Binary file not shown.
Binary file added app/src/main/kotlin/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sqliteJdbcVersion=3.41.2.1
kotlinVersion=1.8.10
neo4jDriverVersion=5.6.0
exposedVersion=0.40.1
Binary file added gradle/.DS_Store
Binary file not shown.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading