/** * Análise infix * @param TreeNode $treeNode * @return string String da expressão */ private function showInFixNode($treeNode) { $output = ''; if ($treeNode != null) { if ($treeNode instanceof TreeNode) { $output .= "( "; } $output .= $this->showInFixNode($treeNode->getLeft()); $output .= "{$treeNode->toString()} "; $output .= $this->showInFixNode($treeNode->getRight()); if ($treeNode instanceof TreeNode) { $output .= ") "; } } return $output; }