From 4ba17336e900a5c1fcf9d9b0a9d87fa6f62d688f Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Thu, 11 Apr 2019 18:58:10 -0300 Subject: Tree updates --- base/src/main/java/bjc/utils/data/ITree.java | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'base/src/main/java/bjc/utils/data/ITree.java') 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 @@ -27,6 +27,14 @@ public interface ITree { */ void addChild(ITree 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. * @@ -111,6 +119,15 @@ public interface ITree { */ 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. * @@ -237,7 +254,7 @@ public interface ITree { * 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 { 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); } -- cgit v1.2.3