AST node representing a number (int or float) More...
Public Member Functions | |
__construct ($p, $q) | |
Constructor. More... | |
getValue () | |
Returns the value. More... | |
getNumerator () | |
getDenominator () | |
accept (Visitor $visitor) | |
Implementing the Visitable interface. | |
compareTo ($other) | |
Implementing the compareTo abstract method. More... | |
![]() | |
compareTo ($other) | |
Helper function, comparing two ASTs. More... | |
evaluate ($variables) | |
Convenience function for evaluating a tree, using the Evaluator class. More... | |
complexity () | |
Rough estimate of the complexity of the AST. More... | |
isTerminal () | |
Returns true if the node is a terminal node, i.e. More... | |
getOperator () | |
__toString () | |
Private Member Functions | |
normalize () | |
Private Attributes | |
$p | |
int $p The numerator of the represented number. More... | |
$q | |
int $q The denominator of the represented number. More... | |
Additional Inherited Members | |
![]() | |
static | rationalFactory (Token $token) |
Node factory, creating an appropriate Node from a Token. More... | |
static | factory (Token $token) |
Node factory, creating an appropriate Node from a Token. More... | |
![]() | |
const | NumericInteger = 1 |
const | NumericRational = 2 |
const | NumericFloat = 3 |
AST node representing a number (int or float)
MathParser\Parsing\Nodes\RationalNode::__construct | ( | $p, | |
$q | |||
) |
Constructor.
Create a RationalNode with given value.
MathParser\Parsing\Nodes\RationalNode::compareTo | ( | $other | ) |
Implementing the compareTo abstract method.
MathParser\Parsing\Nodes\RationalNode::getValue | ( | ) |
Returns the value.
int|float |
|
private |
int $p The numerator of the represented number.
|
private |
int $q The denominator of the represented number.