diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2019-04-11 18:58:10 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2019-04-11 18:58:10 -0300 |
| commit | 4ba17336e900a5c1fcf9d9b0a9d87fa6f62d688f (patch) | |
| tree | 27b65eff5f6fdbd943dfee93f2ddee2c2a675d51 /base/src/main/java/bjc/utils/data/ITree.java | |
| parent | 1084970ceb94424cf08a4dae8d20cb8521c685df (diff) | |
Tree updates
Diffstat (limited to 'base/src/main/java/bjc/utils/data/ITree.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/data/ITree.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/base/src/main/java/bjc/utils/data/ITree.java b/base/src/main/java/bjc/utils/data/ITree.java index bbeaa3f..8ccf50e 100644 --- a/base/src/main/java/bjc/utils/data/ITree.java +++ b/base/src/main/java/bjc/utils/data/ITree.java @@ -28,6 +28,14 @@ public interface ITree<ContainedType> { void addChild(ITree<ContainedType> child); /** + * Append a child to this node. + * + * @param child + * The child to append to this node. + */ + void addChild(ContainedType child); + + /** * Prepend a child to this node. * * @param child @@ -112,6 +120,15 @@ public interface ITree<ContainedType> { int getChildrenCount(); /** + * Get a count of the number of direct children this node has. + * + * @return The number of direct children this node has. + */ + default int size() { + return getChildrenCount(); + } + + /** * Get the data stored in this node. * * @return The data stored in this node. @@ -237,7 +254,7 @@ public interface ITree<ContainedType> { * Check if this tree contains any nodes that satisfy the predicate. * * @param pred - * The predicate to look for. + * The predicate to look for. * * @return Whether or not any items satisfied the predicate. */ @@ -250,4 +267,12 @@ public interface ITree<ContainedType> { return tog.get(); } + + /** + * Set the head of the tree. + * + * @param dat + * The value to set as the head of the tree. + */ + void setHead(ContainedType dat); } |
