public function visitPowerNode(PowerNode $node) { if ($this->_evalIsZero($node->getExponent())) { return true; } return $this->_evalIsOne($node); }
public function visitPowerNode(PowerNode $node) { if ($this->visit($node->getBase())) { return true; } return $this->_evalIsZero($node); }
public function visitPowerNode(PowerNode $node) { $childVisitor = new self($node); $base = $node->getBase(); $exp = $node->getExponent(); return $this->_process($node, $base->accept($childVisitor) . ' ^ ' . $exp->accept($childVisitor)); }
public function visitPowerNode(PowerNode $node) { $v = new XMLVisitor($this->depth + 3); return $this->_renderNode($this->_indent($this->depth + 1) . '<power>' . PHP_EOL . $this->_indent($this->depth + 2) . '<base>' . PHP_EOL . $v->visit($node->getBase()) . PHP_EOL . $this->_indent($this->depth + 2) . '</base>' . PHP_EOL . $this->_indent($this->depth + 2) . '<exponent>' . PHP_EOL . $v->visit($node->getExponent()) . PHP_EOL . $this->_indent($this->depth + 2) . '</exponent>' . PHP_EOL . $this->_indent($this->depth + 1) . '</power>'); }
public function visitPowerNode(PowerNode $node) { $exp = new AdditionNode($node->getExponent(), new ConstantNode(-1)); $pow = new PowerNode($node->getBase(), $exp); return new ArrayMultiplicationNode($node->getExponent(), $pow, $this->visit($node->getBase())); }
public function visitPowerNode(PowerNode $node) { return pow($this->visit($node->getBase()), $this->visit($node->getExponent())); }
public function visitPowerNode(PowerNode $node) { $a = $this->visit($node->getBase()); $b = $this->visit($node->getExponent()); //TODO REMOVE if ($this->isZeroVisitor->visit($a)) { return Tree::init(0); } if ($this->isZeroVisitor->visit($b)) { return Tree::init(1); } if ($this->isOneVisitor->visit($b)) { return $a; } return new PowerNode($a, $b); }