This class represents a node in the abstract syntax tree representation of an expression. More...
#include <ExpressionTreeNode.h>
Private Member Functions | |
void | assignTags (std::vector< const ExpressionTreeNode * > &examples) const |
Private Attributes | |
std::vector< ExpressionTreeNode > | children |
Operation * | operation |
int | tag |
Friends | |
class | ParsedExpression |
This class represents a node in the abstract syntax tree representation of an expression.
Each node is defined by an Operation and a set of children. When the expression is evaluated, each child is first evaluated in order, then the resulting values are passed as the arguments to the Operation's evaluate() method.
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | Operation * | operation, |
const std::vector< ExpressionTreeNode > & | children | ||
) |
Create a new ExpressionTreeNode.
operation | the operation for this node. The ExpressionTreeNode takes over ownership of this object, and deletes it when the node is itself deleted. |
children | the children of this node |
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | Operation * | operation, |
const ExpressionTreeNode & | child1, | ||
const ExpressionTreeNode & | child2 | ||
) |
Create a new ExpressionTreeNode with two children.
operation | the operation for this node. The ExpressionTreeNode takes over ownership of this object, and deletes it when the node is itself deleted. |
child1 | the first child of this node |
child2 | the second child of this node |
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | Operation * | operation, |
const ExpressionTreeNode & | child | ||
) |
Create a new ExpressionTreeNode with one child.
operation | the operation for this node. The ExpressionTreeNode takes over ownership of this object, and deletes it when the node is itself deleted. |
child | the child of this node |
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | Operation * | operation | ) |
Create a new ExpressionTreeNode with no children.
operation | the operation for this node. The ExpressionTreeNode takes over ownership of this object, and deletes it when the node is itself deleted. |
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | const ExpressionTreeNode & | node | ) |
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | ExpressionTreeNode && | node | ) |
PLMD::ExpressionTreeNode::ExpressionTreeNode | ( | ) |
PLMD::ExpressionTreeNode::~ExpressionTreeNode | ( | ) |
|
private |
const vector< ExpressionTreeNode > & PLMD::ExpressionTreeNode::getChildren | ( | ) | const |
Get this node's child nodes.
const Operation & PLMD::ExpressionTreeNode::getOperation | ( | ) | const |
Get the Operation performed by this node.
bool PLMD::ExpressionTreeNode::operator!= | ( | const ExpressionTreeNode & | node | ) | const |
ExpressionTreeNode & PLMD::ExpressionTreeNode::operator= | ( | const ExpressionTreeNode & | node | ) |
ExpressionTreeNode & PLMD::ExpressionTreeNode::operator= | ( | ExpressionTreeNode && | node | ) |
bool PLMD::ExpressionTreeNode::operator== | ( | const ExpressionTreeNode & | node | ) | const |
|
friend |
|
private |
|
private |
|
mutableprivate |
Hosted by GitHub | 1.8.17 |