Helper class for creating ExpressionNodes. More...
Public Member Functions | |
__construct () | |
Constructor. | |
addition ($leftOperand, $rightOperand) | |
Create an addition node representing '$leftOperand + $rightOperand'. More... | |
subtraction ($leftOperand, $rightOperand) | |
Create a subtraction node representing '$leftOperand - $rightOperand'. More... | |
multiplication ($leftOperand, $rightOperand) | |
Create a multiplication node representing '$leftOperand * $rightOperand'. More... | |
division ($leftOperand, $rightOperand) | |
Create a division node representing '$leftOperand / $rightOperand'. More... | |
exponentiation ($leftOperand, $rightOperand) | |
Create an exponentiation node representing '$leftOperand ^ $rightOperand'. More... | |
unaryMinus ($operand) | |
Create a unary minus node representing '-$operand'. More... | |
simplify (ExpressionNode $node) | |
Simplify the given ExpressionNode, using the appropriate factory. More... | |
Protected Attributes | |
$additionFactory | |
Factory for creating addition nodes. | |
$subtractionFactory | |
Factory for creating subtraction nodes (including unary minus) | |
$multiplicationFactory | |
Factory for creating multiplication nodes. | |
$divisionFactory | |
Factory for creating division nodes. | |
$exponentiationFactory | |
Factory for creating exponentiation nodes. | |
Helper class for creating ExpressionNodes.
Wrapper class, setting up factories for creating ExpressionNodes of various types (one for each operator). These factories take case of basic simplification.
MathParser\Parsing\Nodes\Factories\NodeFactory::addition | ( | $leftOperand, | |
$rightOperand | |||
) |
Create an addition node representing '$leftOperand + $rightOperand'.
mixed | $leftOperand | |
mixed | $rightOperand |
ExpressionNode |
MathParser\Parsing\Nodes\Factories\NodeFactory::division | ( | $leftOperand, | |
$rightOperand | |||
) |
Create a division node representing '$leftOperand / $rightOperand'.
mixed | $leftOperand | |
mixed | $rightOperand |
ExpressionNode |
MathParser\Parsing\Nodes\Factories\NodeFactory::exponentiation | ( | $leftOperand, | |
$rightOperand | |||
) |
Create an exponentiation node representing '$leftOperand ^ $rightOperand'.
mixed | $leftOperand | |
mixed | $rightOperand |
ExpressionNode |
MathParser\Parsing\Nodes\Factories\NodeFactory::multiplication | ( | $leftOperand, | |
$rightOperand | |||
) |
Create a multiplication node representing '$leftOperand * $rightOperand'.
mixed | $leftOperand | |
mixed | $rightOperand |
ExpressionNode |
MathParser\Parsing\Nodes\Factories\NodeFactory::simplify | ( | ExpressionNode | $node | ) |
Simplify the given ExpressionNode, using the appropriate factory.
ExpressionNode | $node |
Node | Simplified version of the input |
MathParser\Parsing\Nodes\Factories\NodeFactory::subtraction | ( | $leftOperand, | |
$rightOperand | |||
) |
Create a subtraction node representing '$leftOperand - $rightOperand'.
mixed | $leftOperand | |
mixed | $rightOperand |
ExpressionNode |
MathParser\Parsing\Nodes\Factories\NodeFactory::unaryMinus | ( | $operand | ) |
Create a unary minus node representing '-$operand'.
mixed | $operand |
ExpressionNode |