mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2025-04-19 23:19:03 +02:00
Set up GitHub Actions
This commit is contained in:
parent
43b8982b88
commit
12b1df764c
24
.github/workflows/commit.yml
vendored
Normal file
24
.github/workflows/commit.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
name: Publish
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: adopt
|
||||||
|
java-version: 11
|
||||||
|
|
||||||
|
# Builds the release artifacts of the library
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew :assembleRelease
|
||||||
|
|
||||||
|
# Generates other artifacts (javadocJar is optional)
|
||||||
|
- name: Source jar and dokka
|
||||||
|
run: ./gradlew androidSourcesJar javadocJar
|
20
.github/workflows/pull_request.yml
vendored
Normal file
20
.github/workflows/pull_request.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
name: Publish
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: adopt
|
||||||
|
java-version: 11
|
||||||
|
|
||||||
|
# Builds the release artifacts of the library
|
||||||
|
- name: Test
|
||||||
|
run: ./gradlew test
|
@ -41,6 +41,7 @@ open class TreeNode<T>(val value: T) : Iterable<TreeNode<T>>, ChildDeclarationIn
|
|||||||
* @return `true` if the node has been successfully removed; `false` if it was not present in the tree.
|
* @return `true` if the node has been successfully removed; `false` if it was not present in the tree.
|
||||||
*/
|
*/
|
||||||
fun removeChild(child: TreeNode<T>): Boolean {
|
fun removeChild(child: TreeNode<T>): Boolean {
|
||||||
|
println(child.value)
|
||||||
val removed = child._parent?._children?.remove(child)
|
val removed = child._parent?._children?.remove(child)
|
||||||
child._parent = null
|
child._parent = null
|
||||||
return removed ?: false
|
return removed ?: false
|
||||||
|
@ -43,7 +43,8 @@ class TreeNodeTest {
|
|||||||
"│ └── Milk Shake\n" +
|
"│ └── Milk Shake\n" +
|
||||||
"└── Curd\n" +
|
"└── Curd\n" +
|
||||||
" ├── yogurt\n" +
|
" ├── yogurt\n" +
|
||||||
" └── lassi\n", root.toString()
|
" └── lassi\n",
|
||||||
|
root.prettyString()
|
||||||
)
|
)
|
||||||
|
|
||||||
println("Remove: ${curdNode.value}")
|
println("Remove: ${curdNode.value}")
|
||||||
@ -56,7 +57,8 @@ class TreeNodeTest {
|
|||||||
" ├── tea\n" +
|
" ├── tea\n" +
|
||||||
" │ └── normal tea\n" +
|
" │ └── normal tea\n" +
|
||||||
" ├── coffee\n" +
|
" ├── coffee\n" +
|
||||||
" └── Milk Shake\n", root.toString()
|
" └── Milk Shake\n",
|
||||||
|
root.prettyString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user