#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 () | |
| Default constructor. |
|
| ExpressionTree (const ExpressionTree &tree) | |
| Copy constructor. |
|
| ExpressionTree (ExpressionPredicate *predicate, bool negate=false) | |
| Detailed constructor. |
|
| ExpressionTree (Type type, list< const ExpressionTree * > children, bool negate=false) | |
| virtual | ~ExpressionTree () |
| Destructor. |
|
|
Predicates
|
|
| virtual bool | operator() (const Atom &atom) const |
| Evaluate the
(sub)expression. |
|
| bool | operator== (const ExpressionTree &tree) const |
| Equality operator. |
|
| bool | operator!= (const ExpressionTree &tree) const |
| Inequality operator. |
|
|
Accessors
|
|
| void | setType (Type type) |
| Set the expression node's
type. |
|
| Type | getType () const |
| Get the expression node's
type. |
|
| void | setNegate (bool negate) |
| Set the expression node's negation
mode. |
|
| bool | getNegate () const |
| Get the expression node's negation
mode. |
|
| void | setPredicate (ExpressionPredicate *predicate) |
| Set the predicate. |
|
| ExpressionPredicate * | getPredicate () const |
| Get the predicate. |
|
| void | appendChild (const ExpressionTree *child) |
| Append a child to the
tree. |
|
|
const list< const ExpressionTree * > & |
getChildren () const |
| Get the list of children. |
|
|
Assignment
|
|
| ExpressionTree & | operator= (const ExpressionTree &tree) |
| Asignment operator. |
|
| virtual void | clear () |
| Clear method. |
|
|
Debugging
|
|
| void | dump (std::ostream &is=std::cout, Size depth=0) const |
Protected Member Functions |
|
| bool | compareChildren_ (const ExpressionTree &tree) const |
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.
| BALL::ExpressionTree::ExpressionTree | ( | ) |
Default constructor.
Create an empty expression node. The node's type is set
to INVALID, negate_ is set to false,
the internal predicate is set to 0, and the list of
children is empty.
| BALL::ExpressionTree::ExpressionTree | ( | const ExpressionTree & | tree | ) |
Copy constructor.
Note that this copy constructor does not copy predicates but only stores pointers to them.
| BALL::ExpressionTree::ExpressionTree | ( | ExpressionPredicate * | predicate, | |
| bool | negate =
false |
|||
| ) |
Detailed constructor.
Create an expression node representing a leaf, i.e., a predicate.
| predicate | the node's predicate | |
| negate | set to true if the node's predicate should be negated |
1.5.8