Basic Polynomial Algebra Subprograms (BPAS)  v. 1.791
Public Member Functions | Static Public Member Functions | List of all members
ExpressionTree Class Reference

An ExpressionTree encompasses various forms of data that can be expressed generically as a binary tree with data elements connected by operators. More...

#include <ExpressionTree.hpp>

Public Member Functions

 ExpressionTree ()
 Construct the default, empty tree.
 
 ExpressionTree (ExprTreeNode *theRoot)
 Construct a tree given the root node.
 
 ExpressionTree (const ExpressionTree &otherTree)
 Copy constructor.
 
 ExpressionTree (const std::vector< ExpressionTree > &trees)
 Construct a stree from a vector of trees as an array of trees.
 
 ~ExpressionTree ()
 Destructor.
 
ExpressionTreeoperator= (const ExpressionTree &otherTree)
 Copy assignment.
 
ExpressionTree operator+ (const ExpressionTree &rightTree)
 Combine *this and the input rightTree into a new expression tree adjoining the two trees with addition. More...
 
ExpressionTreeoperator+= (const ExpressionTree &rightTree)
 Add the input rightTree to the right side of *this, adjoining the two trees with addition. More...
 
ExpressionTree operator- (const ExpressionTree &rightTree)
 Combine *this and the input rightTree into a new expression tree adjoining the two trees with subtraction. More...
 
ExpressionTreeoperator-= (const ExpressionTree &rightTree)
 Add the input rightTree to the right side of *this, adjoining the two trees with subtraction. More...
 
ExpressionTree operator* (const ExpressionTree &rightTree)
 Combine *this and the input rightTree into a new expression tree adjoining the two trees with multiplication. More...
 
ExpressionTreeoperator*= (const ExpressionTree &rightTree)
 Add the input rightTree to the right side of *this, adjoining the two trees with multiplication. More...
 
ExpressionTree operator/ (const ExpressionTree &rightTree)
 Combine *this and the input rightTree into a new expression tree adjoining the two trees with divison. More...
 
ExpressionTreeoperator/= (const ExpressionTree &rightTree)
 Add the input rightTree to the right side of *this, adjoining the two trees with division. More...
 
ExpressionTree operator^ (const ExpressionTree &rightTree)
 Combine *this and the input rightTree into a new expression tree adjoining the two trees with divison. More...
 
ExpressionTreeoperator^= (const ExpressionTree &rightTree)
 Add the input rightTree to the right side of *this, adjoining the two trees with division. More...
 
std::string toString () const
 Convert *this to a generic string representation.
 
std::string toMapleString () const
 Convert *this to a string in the format expected of a maple expression. More...
 
std::string toLaTeXString () const
 Convert *this to a string in the format expected of LaTeX. More...
 
template<class ExpTreeConvert >
void fromVector (const std::vector< ExpTreeConvert > &ringVec)
 Fill this expression tree with the vector of BPASRing elements specified. More...
 

Static Public Member Functions

static ExpressionTree combineExpressionTrees (const ExpressionTree &left, const ExpressionTree &right, ExprTreeType type, ExprTreeVal *val=NULL)
 Combine two expression trees using the supplied type and value as their common parent. More...
 

Detailed Description

An ExpressionTree encompasses various forms of data that can be expressed generically as a binary tree with data elements connected by operators.

Provides functions for converting this generic datatype into various external formats. For example, maple expression strings or latex mathmode strings.

Member Function Documentation

◆ combineExpressionTrees()

static ExpressionTree ExpressionTree::combineExpressionTrees ( const ExpressionTree left,
const ExpressionTree right,
ExprTreeType  type,
ExprTreeVal val = NULL 
)
static

Combine two expression trees using the supplied type and value as their common parent.

This method will create copies of the input trees to use.

returns the adjoined ExpressionTree.

◆ fromVector()

template<class ExpTreeConvert >
void ExpressionTree::fromVector ( const std::vector< ExpTreeConvert > &  ringVec)
inline

Fill this expression tree with the vector of BPASRing elements specified.

This clears this tree's current contents. ringVec: a vector of BPASRing elements.

◆ operator*()

ExpressionTree ExpressionTree::operator* ( const ExpressionTree rightTree)

Combine *this and the input rightTree into a new expression tree adjoining the two trees with multiplication.

returns the new tree.

◆ operator*=()

ExpressionTree& ExpressionTree::operator*= ( const ExpressionTree rightTree)

Add the input rightTree to the right side of *this, adjoining the two trees with multiplication.

returns a reference to *this, the updated tree.

◆ operator+()

ExpressionTree ExpressionTree::operator+ ( const ExpressionTree rightTree)

Combine *this and the input rightTree into a new expression tree adjoining the two trees with addition.

returns the new tree.

◆ operator+=()

ExpressionTree& ExpressionTree::operator+= ( const ExpressionTree rightTree)

Add the input rightTree to the right side of *this, adjoining the two trees with addition.

returns a reference to *this, the updated tree.

◆ operator-()

ExpressionTree ExpressionTree::operator- ( const ExpressionTree rightTree)

Combine *this and the input rightTree into a new expression tree adjoining the two trees with subtraction.

returns the new tree.

◆ operator-=()

ExpressionTree& ExpressionTree::operator-= ( const ExpressionTree rightTree)

Add the input rightTree to the right side of *this, adjoining the two trees with subtraction.

returns a reference to *this, the updated tree.

◆ operator/()

ExpressionTree ExpressionTree::operator/ ( const ExpressionTree rightTree)

Combine *this and the input rightTree into a new expression tree adjoining the two trees with divison.

returns the new tree.

◆ operator/=()

ExpressionTree& ExpressionTree::operator/= ( const ExpressionTree rightTree)

Add the input rightTree to the right side of *this, adjoining the two trees with division.

returns a reference to *this, the updated tree.

◆ operator^()

ExpressionTree ExpressionTree::operator^ ( const ExpressionTree rightTree)

Combine *this and the input rightTree into a new expression tree adjoining the two trees with divison.

returns the new tree.

◆ operator^=()

ExpressionTree& ExpressionTree::operator^= ( const ExpressionTree rightTree)

Add the input rightTree to the right side of *this, adjoining the two trees with division.

returns a reference to *this, the updated tree.

◆ toLaTeXString()

std::string ExpressionTree::toLaTeXString ( ) const

Convert *this to a string in the format expected of LaTeX.

returns a string in latex format.

◆ toMapleString()

std::string ExpressionTree::toMapleString ( ) const

Convert *this to a string in the format expected of a maple expression.

returns a string in maple format


The documentation for this class was generated from the following file: