/** * Add child node * * @param \Includes\DataStructure\Graph $node Node to add * * @return void */ public function addChild(\Includes\DataStructure\Graph $node) { $node->setParent($this); parent::addChild($node); }
/** * So called "re-plant" operation: change node parent * * @param \Includes\DataStructure\Graph $oldParent Replant from * @param \Includes\DataStructure\Graph $newParent Replant to * * @return void */ public function replant(\Includes\DataStructure\Graph $oldParent, \Includes\DataStructure\Graph $newParent) { $oldParent->removeChild($this); $newParent->addChild($this); }
/** * Add child node * * @param \Includes\DataStructure\Graph $node Node to add * * @return void */ public function addChild(\Includes\DataStructure\Graph $node) { parent::addChild($node); $node->setParentClass($this->getClass()); }
/** * Add child node * * @param self $node Node to add * * @return void */ public function addChild(self $node) { parent::addChild($node); $node->setParentClass($this->getClass()); }
/** * So called "re-plant" operation: change node parent * * @param self $oldParent Replant from * @param self $newParent Replant to * * @return void */ public function replant(self $oldParent, self $newParent) { $oldParent->removeChild($this); $newParent->addChild($this); }