X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Futil%2Fdata%2FNode.java;h=3ba6004883c3f6b7d97b99c73dd900538e13cf9c;hb=364659907c0364092e78824d3eea4a13fecd831b;hp=7737d5027c649766523224194db23bdc868e5b28;hpb=415d6680a02bfbd85ad3f154a7c7f2aee5453549;p=jSite2.git diff --git a/src/net/pterodactylus/util/data/Node.java b/src/net/pterodactylus/util/data/Node.java index 7737d50..3ba6004 100644 --- a/src/net/pterodactylus/util/data/Node.java +++ b/src/net/pterodactylus/util/data/Node.java @@ -54,6 +54,36 @@ public interface Node extends Iterable> { public Node getChild(int index); /** + * Returns whether the given node is a direct child of this node. + * + * @param childNode + * The child node + * @return true if the given node is a direct child of this + * node, false otherwise + */ + public boolean hasChildNode(Node childNode); + + /** + * Returns the index of the given child node. + * + * @param childNode + * The child node + * @return The index of the child node, or -1 if the child + * node is not a child node of this node + */ + public int getIndexOfChild(Node childNode); + + /** + * Returns the index of the child node containing the given element. + * + * @param element + * The element + * @return The index of the child node, or -1 if the child + * node is not a child node of this node + */ + public int getIndexOfChild(E element); + + /** * Remove the given child node from this node. If the given node is not a * child of this node, nothing happens. * @@ -84,4 +114,15 @@ public interface Node extends Iterable> { */ public Iterator> iterator(); + /** + * Searches this node’s children recursively for a node that contains the + * given element. + * + * @param element + * The element to search + * @return The node that contains the given element, or null + * if no node could be found + */ + public Node findChild(E element); + } \ No newline at end of file