kind = $kind; $this->list = array(); } public function getKind() { return($this->kind); } public function getList() { return($this->list); } public function add($name, $value, $op = null) { $term = array($name, $value, $op); $this->list[] = $term; } public function addTerms($kind) { $child = new IMuTerms($kind); $this->list[] = $child; return($child); } public function addAnd() { return($this->addTerms('and')); } public function addOr() { return($this->addTerms('or')); } public function toArray() { $result = array(); $result[0] = $this->kind; $list = array(); for ($i = 0; $i < count($this->list); $i++) { $term = $this->list[$i]; if ($term instanceof IMuTerms) { $term = $term->toArray(); } $list[$i] = $term; } $result[1] = $list; return($result); } public function __toString() { $result = '['; $result .= $this->kind; $result .= ', ['; for ($i = 0; $i < count($this->list); $i++) { if ($i > 0) { $result .= ', '; } $term = $this->list[$i]; if ($term instanceof IMuTerms) { $term = $term->__toString(); } else { $term = '[' . implode(', ', $term) . ']'; } $result .= $term; } $result .= ']]'; return($result); } public function toString() { return($this->__toString()); } private $kind = null; private $list = null; } ?>