BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Tree\Node Namespace Reference

Classes

class  Node
 
interface  NodeInterface
 

Functions

 __construct ($value=null, array $children=[])
 
 setValue ($value)
 
 getValue ()
 
 addChild (NodeInterface $child)
 
 removeChild (NodeInterface $child)
 
 removeAllChildren ()
 
 getChildren ()
 
 setChildren (array $children)
 
 setParent (NodeInterface $parent=null)
 
 getParent ()
 
 getAncestors ()
 
 getAncestorsAndSelf ()
 
 getNeighbors ()
 
 getNeighborsAndSelf ()
 
 isLeaf ()
 
 isRoot ()
 
 isChild ()
 
 root ()
 
 getDepth ()
 
 getHeight ()
 
 getSize ()
 
 accept (Visitor $visitor)
 

Variables

trait NodeTrait
 
 $parent
 
 $children = []
 

Detailed Description

This file is part of Tree

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

Author
Nicolò Martini nicma.nosp@m.rtni.nosp@m.c@gma.nosp@m.il.c.nosp@m.om

Function Documentation

Tree\Node\__construct (   $value = null,
array  $children = [] 
)
Parameters
mixed$value
NodeInterface[]$children
Tree\Node\accept ( Visitor  $visitor)

{}

Tree\Node\addChild ( NodeInterface  $child)

{}

Tree\Node\getAncestors ( )

{}

Tree\Node\getAncestorsAndSelf ( )
Tree\Node\getChildren ( )

{}

Tree\Node\getDepth ( )

Return the distance from the current node to the root.

Warning, can be expensive, since each descendant is visited

Returns
int
Tree\Node\getHeight ( )

Return the height of the tree whose root is this node

Returns
int
Tree\Node\getNeighbors ( )

{}

Tree\Node\getNeighborsAndSelf ( )
Tree\Node\getParent ( )

{}

Tree\Node\getSize ( )

Return the number of nodes in a tree

Returns
int
Tree\Node\getValue ( )

{}

Tree\Node\isChild ( )
Tree\Node\isLeaf ( )
Tree\Node\isRoot ( )
Returns
bool
Tree\Node\removeAllChildren ( )

{}

Tree\Node\removeChild ( NodeInterface  $child)

{}

Tree\Node\root ( )

Find the root of the node

Returns
NodeInterface
Tree\Node\setChildren ( array  $children)

{}

Tree\Node\setParent ( NodeInterface  $parent = null)

{}

Tree\Node\setValue (   $value)

{}

Variable Documentation

trait Tree::Node\NodeTrait
Initial value:
{
private $value