Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezptopologicalsortnode.php
Go to the documentation of this file.
1 <?php
17 class ezpTopologicalSortNode
18 {
19 public $name;
20
21 protected $children;
22 protected $parents;
23
29 public function __construct( $name )
30 {
31 $this->name = $name;
32 $this->children = new SplObjectStorage();
33 $this->parents = new SplObjectStorage();
34 }
35
41 public function registerChild( ezpTopologicalSortNode $childNode )
42 {
43 if (! $this->children->contains( $childNode ) )
44 $this->children->attach( $childNode );
45 }
46
52 public function registerParent( ezpTopologicalSortNode $parentNode )
53 {
54 if (! $this->parents->contains( $parentNode ) )
55 $this->parents->attach( $parentNode );
56 }
57
63 public function unregisterParent( ezpTopologicalSortNode $parentNode )
64 {
65 $this->parents->detach( $parentNode );
66 }
67
73 public function parentCount()
74 {
75 return $this->parents->count();
76 }
77
83 public function popChild()
84 {
85 // Rewind if current iterator is not valid
86 if (! $this->children->valid() )
87 $this->children->rewind();
88
89 // If current iterator is still not valid it means there are no children anymore
90 if (! $this->children->valid() )
91 return false;
92
93 $child = $this->children->current();
94 $this->children->detach( $child );
95 return $child;
96 }
97 }
98 ?>
ezpTopologicalSortNode
Definition: ezptopologicalsortnode.php:18
ezpTopologicalSortNode\$name
$name
Definition: ezptopologicalsortnode.php:19
ezpTopologicalSortNode\unregisterParent
unregisterParent(ezpTopologicalSortNode $parentNode)
Definition: ezptopologicalsortnode.php:63
ezpTopologicalSortNode\$children
$children
Definition: ezptopologicalsortnode.php:21
ezpTopologicalSortNode\popChild
popChild()
Definition: ezptopologicalsortnode.php:83
ezpTopologicalSortNode\__construct
__construct( $name)
Definition: ezptopologicalsortnode.php:29
ezpTopologicalSortNode\registerParent
registerParent(ezpTopologicalSortNode $parentNode)
Definition: ezptopologicalsortnode.php:52
ezpTopologicalSortNode\parentCount
parentCount()
Definition: ezptopologicalsortnode.php:73
ezpTopologicalSortNode\$parents
$parents
Definition: ezptopologicalsortnode.php:22
ezpTopologicalSortNode\registerChild
registerChild(ezpTopologicalSortNode $childNode)
Definition: ezptopologicalsortnode.php:41
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.