Skip to content

Commit

Permalink
update gradle to new version 8.3
Browse files Browse the repository at this point in the history
- new method 'addChild' to insert a child tree node with a specific given index
- new method 'getChildAt' to get an optional of the child tree node with the given index
- new method 'getChildIndex' to the index from the given child tree node
  • Loading branch information
astrapi69 committed Aug 17, 2023
1 parent f3ef237 commit b7ce2b3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
Version 1.5-SNAPSHOT
-------------

ADDED:

- new method 'addChild' to insert a child tree node with a specific given index
- new method 'getChildAt' to get an optional of the child tree node with the given index
- new method 'getChildIndex' to the index from the given child tree node

CHANGED:

- update gradle to new version 8.3

Version 1.4
-------------
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Wed Feb 19 18:39:09 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-rc-4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/io/github/astrapi69/tree/api/ITree.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

import lombok.NonNull;

Expand All @@ -49,6 +50,16 @@ public interface ITree<V, T> extends Serializable
*/
void addChild(final T child);

/**
* Adds the given child to this tree node
*
* @param child
* the child
* @param index
* the index of the child to insert
*/
void addChild(final T child, int index);

/**
* Adds all the given children to this tree node
*
Expand Down Expand Up @@ -97,6 +108,24 @@ public interface ITree<V, T> extends Serializable
*/
Collection<T> getChildren();

/**
* Gets the child tree node from the given index
*
* @param index
* the index of the child to get
* @return an {@link Optional} object with the child tree node from the given index
*/
Optional<T> getChildAt(int index);

/**
* Gets the index of the given child in this tree node
*
* @param child
* the child to resolve the index
* @return the index of the given child in this tree node
*/
int getChildIndex(T child);

/**
* Sets the children of this tree node
*
Expand Down

0 comments on commit b7ce2b3

Please sign in to comment.