name = $name; } /** * VariableInformationTree::getName() * * @return */ public function getName() { return $this->name; } /** * VariableInformationTree::getChildByName() * * @param mixed $name * @return */ public function getChildByName($name) { foreach($this->children as $child) { if($child instanceof VariableInformationTree && $child->getName() == $name) return $child; } throw new Exception("No child with name '$name' found."); } /** * VariableInformationTree::isName() * * @param mixed $name * @return */ public function testNameInChildren($name) { if($this->getChildByName($name) === false) return false; else return true; } public function isName($name) { return $this->name == $name; } public function getPos($pos) { throw new Exception(__CLASS__." has no positions."); } public function getPosInChildren($pos) { throw new Exception(__CLASS__." has no positions."); } /** * VariableInformationTree::accept() * * @param Visitor $visitor * @return */ public function accept(Visitor $visitor, $level = 1) { $visitor->visit($this, $level++); foreach($this->children as $child) { $child->accept($visitor, $level); } } // end of member function accept } // end of VariableInformationTree ?>