* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ abstract class ListPathElement extends ListComposite { // private $name; // public $refListDataElement; // // function __construct(ListPathElement $ref = null, $pos = null) { // if ($ref == null) { // $this ist eine RootNode // return; // } // elseif ($ref instanceof ListPathElement && $pos != null) { // $this ist ein Objekt im Content/Value-Tree // $this->refListDataElement = $ref; // $this->pos = $pos; // } // elseif ($pos == null) { // $this ist ein Objekt im Data-Tree // $this->name = $ref; // } else // throw new Exception("Wrong parameter count for " . __CLASS__ . "::" . __METHOD__); // } // function getName() { // if ($this->refListDataElement) // Content-Tree // return $this->refListDataElement->name; // else // Data-Tree // return $this->name; // } function isExistingName($comp) { foreach ($this->children as $child) { if ($child instanceof ListPathDataElement || $child instanceof ListPathContentElement) if ($child->getName() == $comp) return true; } return false; } function getChildByName($name) { foreach ($this->children as $key => $child) { if ($child instanceof ListPathContentElement || $child instanceof ListPathDataElement) { if ($child->getName() == $name) { return $child; } } } return false; } // function getValue($name = null) { // if ($name) // return $this->getChildByName($name)->children[0]->getValue(); // else // return $this->children[0]->getValue(); // } // function getChildByPos($pos) { // foreach ($this->children as $child) { // if ($child instanceof ListPathElement) // if ($child->getPos() == $pos) // return $child; // } // } function getFullVariableName($level = 0) { $name = ""; if ($level > 1) $name = "_" . $this->pos . "_"; $name .= $this->refListDataElement->name; foreach ($this->children as $key => $child) { if ($child instanceof ListPathElement) $name .= $child->getFullVariableName($level +1); } return $name; } } ?>