5 * Every node of a database object tree has to implement this interface.
7 * @author Matthias Schmidt
8 * @copyright 2001-2019 WoltLab GmbH
9 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
10 * @package WoltLabSuite\Core\Data
13 interface IObjectTreeNode
extends \Countable
, IIDObject
, \RecursiveIterator
{
15 * Adds the given node as child node and sets the child node's parent node to this node.
17 * @param IObjectTreeNode $child added child node
18 * @throws \InvalidArgumentException if given object is no (deocrated) instance of this class
20 public function addChild(IObjectTreeNode
$child);
23 * Returns the depth of the node within the tree.
25 * The minimum depth is `1`.
29 public function getDepth();
32 * Returns the number of open parent nodes.
36 public function getOpenParentNodes();
39 * Retruns the parent node of this node.
41 * @return static parent node
43 public function getParentNode();
46 * Returns `true` if this node is the last sibling and `false` otherwise.
50 public function isLastSibling();
53 * Sets the parent node of this node.
55 * @param IObjectTreeNode $parentNode parent node
56 * @throws \InvalidArgumentException if given object is no (deocrated) instance of this class
58 public function setParentNode(IObjectTreeNode
$parentNode);