#include <expressionTree.h>
Public Types | |
Type Definitions | |
enum | Type { INVALID = 0, LEAF, OR, AND } |
The type of an expression node in the tree. More... | |
Public Member Functions | |
Constructors and Destructor | |
ExpressionTree () throw () | |
Default constructor. | |
ExpressionTree (const ExpressionTree &tree) throw () | |
Copy constructor. | |
ExpressionTree (ExpressionPredicate *predicate, bool negate=false) throw () | |
Detailed constructor. | |
ExpressionTree (Type type, list< const ExpressionTree * > children, bool negate=false) throw () | |
virtual | ~ExpressionTree () throw () |
Destructor. | |
Predicates | |
virtual bool | operator() (const Atom &atom) const throw () |
Evaluate the (sub)expression. | |
bool | operator== (const ExpressionTree &tree) const throw () |
Equality operator. | |
bool | operator!= (const ExpressionTree &tree) const throw () |
Inequality operator. | |
Accessors | |
void | setType (Type type) throw () |
Set the expression node's type. | |
Type | getType () const throw () |
Get the expression node's type. | |
void | setNegate (bool negate) throw () |
Set the expression node's negation mode. | |
bool | getNegate () const throw () |
Get the expression node's negation mode. | |
void | setPredicate (ExpressionPredicate *predicate) throw () |
Set the predicate. | |
ExpressionPredicate * | getPredicate () const throw () |
Get the predicate. | |
void | appendChild (const ExpressionTree *child) throw () |
Append a child to the tree. | |
const list< const ExpressionTree * > & | getChildren () const throw () |
Get the list of children. | |
Assignment | |
ExpressionTree & | operator= (const ExpressionTree &tree) throw () |
Asignment operator. | |
virtual void | clear () throw () |
Clear method. | |
Debugging | |
void | dump (std::ostream &is=std::cout, Size depth=0) const throw () |
Protected Member Functions | |
bool | compareChildren_ (const ExpressionTree &tree) const throw () |
Protected Attributes | |
Type | type_ |
bool | negate_ |
ExpressionPredicate * | predicate_ |
list< const ExpressionTree * > | children_ |
Represents the logical tree of an Expression. This is the backend of Expression.
|
The type of an expression node in the tree. The type determines how a node is to be interpreted. |
|
Default constructor.
Create an empty expression node. The node's type is set to INVALID, |
|
Copy constructor. Note that this copy constructor does not copy predicates but only stores pointers to them. |
|
Detailed constructor. Create an expression node representing a leaf, i.e., a predicate.
|
|
Append a child to the tree.
|
|
Get the list of children.
|
|
Get the expression node's negation mode.
|
|
Get the predicate.
|
|
Evaluate the (sub)expression.
|
|
Set the expression node's negation mode.
|
|
Set the predicate.
|
|
Set the expression node's type.
|