![]() |
Basic Polynomial Algebra Subprograms (BPAS)
v. 1.791
|
ExprTreeNode is a single node in the bianry tree of an ExpressionTree. More...
#include <ExprTreeNode.hpp>
Public Member Functions | |
| ExprTreeNode () | |
| Construct a default, empty ExprTreeNode. | |
| ExprTreeNode (ExprTreeType type, ExprTreeVal *val, ExprTreeNode *lNode, ExprTreeNode *rNode) | |
| Construct an ExprTreeNode given its type, value, and left and right children. More... | |
| ExprTreeNode (const std::string &s) | |
| Construct an ExprTreeNode of type EXPR_VAR with a copy of s as data. | |
| ExprTreeNode (long int i) | |
| Construct an ExprTreeNode of type EXPR_INT with i as data. | |
| ExprTreeNode (const mpz_class &z) | |
| Construct an ExprTreeNode of type EXPR_MPZ with a copy of z as data. | |
| ExprTreeNode (const mpq_class &q) | |
| Construct an ExprTreeNode of type EXPR_MPQ with a copy of q as data. | |
| ExprTreeNode (const Symbol &s) | |
| Construct an ExpeTreeNode of type EXPR_SYM with a copy of s as data. | |
| ~ExprTreeNode () | |
| ExprTreeNode destructor. | |
| bool | findChildType (ExprTreeType searchType) |
| Determine if *this or any of it's children is of type searchType. More... | |
| std::string | toString () const |
| Covnert *this to a string, depending on it's type and data. More... | |
| bool | isVar () const |
| Check to see if the expression rooted at *this encodes a variable or a variable to a power. | |
| bool | isConstant () const |
| Check to see if the expression rooted at *this encodes a constant. More... | |
| bool | isPolynomialTerm () const |
| Check to see if the expression rooted at *this encodes a monomial. More... | |
| ExprTreeNode * | deepCopy () const |
| Get a deep copy of the tree rooted at root. More... | |
Static Public Member Functions | |
| static ExprTreeNode * | combineExprTreeNodes (ExprTreeNode *lNode, ExprTreeNode *rNode, ExprTreeType tType, ExprTreeVal *vVal=NULL) |
| Creates a new ExprTreeNode and combines two sub-trees (lNode and rNode) by adjoining them to the newly created node as their root. More... | |
Public Attributes | |
| ExprTreeNode * | left |
| ExprTreeNode * | right |
| ExprTreeType | type |
| ExprTreeVal | val |
ExprTreeNode is a single node in the bianry tree of an ExpressionTree.
Nodes have a recursive structure, where each node is the root of a sub-tree with edges connecting *this node to the left and right sub-trees.
Each tree has a type and a val. The type is used to specify how the val should interpreted.
See Also, The enum ExprTreeType, and the union ExprTreeVal.
| ExprTreeNode::ExprTreeNode | ( | ExprTreeType | type, |
| ExprTreeVal * | val, | ||
| ExprTreeNode * | lNode, | ||
| ExprTreeNode * | rNode | ||
| ) |
Construct an ExprTreeNode given its type, value, and left and right children.
Value and children can be NULL.
|
static |
Creates a new ExprTreeNode and combines two sub-trees (lNode and rNode) by adjoining them to the newly created node as their root.
The newly created node has type tType and val vVal (if vVal is not NULL).
| ExprTreeNode* ExprTreeNode::deepCopy | ( | ) | const |
Get a deep copy of the tree rooted at root.
Node that if the node or any its children hold data as a void* then that data will NOT be deeply copied.
returns the new root
| bool ExprTreeNode::findChildType | ( | ExprTreeType | searchType | ) |
Determine if *this or any of it's children is of type searchType.
returns true iff searchType found.
| bool ExprTreeNode::isConstant | ( | ) | const |
Check to see if the expression rooted at *this encodes a constant.
That is, an integer, a rational number, etc.
| bool ExprTreeNode::isPolynomialTerm | ( | ) | const |
Check to see if the expression rooted at *this encodes a monomial.
returns true iff *this encodes a monomial.
| std::string ExprTreeNode::toString | ( | ) | const |
Covnert *this to a string, depending on it's type and data.
Only convert this particular node, not it's children. This allows for different tree traversals.
1.8.13