Esempio n. 1
0
 public function visitPowerNode(PowerNode $node)
 {
     if ($this->_evalIsZero($node->getExponent())) {
         return true;
     }
     return $this->_evalIsOne($node);
 }
Esempio n. 2
0
 public function visitPowerNode(PowerNode $node)
 {
     if ($this->visit($node->getBase())) {
         return true;
     }
     return $this->_evalIsZero($node);
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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>');
 }
Esempio n. 5
0
 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()));
 }
Esempio n. 6
0
 public function visitPowerNode(PowerNode $node)
 {
     return pow($this->visit($node->getBase()), $this->visit($node->getExponent()));
 }
Esempio n. 7
0
 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);
 }