#include <BALL/KERNEL/expressionTree.h>
Public Types | |
Type Definitions | |
enum | Type { INVALID = 0, LEAF, OR, AND } |
Public Member Functions | |
Constructors and Destructor | |
ExpressionTree () | |
ExpressionTree (const ExpressionTree &tree) | |
ExpressionTree (ExpressionPredicate *predicate, bool negate=false) | |
ExpressionTree (Type type, list< const ExpressionTree * > children, bool negate=false) | |
virtual | ~ExpressionTree () |
Predicates | |
virtual bool | operator() (const Atom &atom) const |
bool | operator== (const ExpressionTree &tree) const |
bool | operator!= (const ExpressionTree &tree) const |
Accessors | |
void | setType (Type type) |
Type | getType () const |
void | setNegate (bool negate) |
bool | getNegate () const |
void | setPredicate (ExpressionPredicate *predicate) |
ExpressionPredicate * | getPredicate () const |
void | appendChild (const ExpressionTree *child) |
const list< const ExpressionTree * > & | getChildren () const |
Assignment | |
ExpressionTree & | operator= (const ExpressionTree &tree) |
virtual void | clear () |
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_ |
Expression tree class. 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 |
BALL::ExpressionTree::ExpressionTree | ( | Type | type, | |
list< const ExpressionTree * > | children, | |||
bool | negate = false | |||
) |
virtual BALL::ExpressionTree::~ExpressionTree | ( | ) | [virtual] |
Destructor
void BALL::ExpressionTree::appendChild | ( | const ExpressionTree * | child | ) |
Append a child to the tree.
virtual void BALL::ExpressionTree::clear | ( | ) | [virtual] |
Clear method
bool BALL::ExpressionTree::compareChildren_ | ( | const ExpressionTree & | tree | ) | const [protected] |
void BALL::ExpressionTree::dump | ( | std::ostream & | is = std::cout , |
|
Size | depth = 0 | |||
) | const |
const list<const ExpressionTree*>& BALL::ExpressionTree::getChildren | ( | ) | const |
Get the list of children.
bool BALL::ExpressionTree::getNegate | ( | ) | const |
Get the expression node's negation mode.
ExpressionPredicate* BALL::ExpressionTree::getPredicate | ( | ) | const |
Get the predicate.
Type BALL::ExpressionTree::getType | ( | ) | const |
Get the expression node's type
bool BALL::ExpressionTree::operator!= | ( | const ExpressionTree & | tree | ) | const |
Inequality operator
Evaluate the (sub)expression.
ExpressionTree& BALL::ExpressionTree::operator= | ( | const ExpressionTree & | tree | ) |
Asignment operator
bool BALL::ExpressionTree::operator== | ( | const ExpressionTree & | tree | ) | const |
Equality operator
void BALL::ExpressionTree::setNegate | ( | bool | negate | ) |
Set the expression node's negation mode.
void BALL::ExpressionTree::setPredicate | ( | ExpressionPredicate * | predicate | ) |
Set the predicate.
void BALL::ExpressionTree::setType | ( | Type | type | ) |
Set the expression node's type.
list<const ExpressionTree*> BALL::ExpressionTree::children_ [protected] |
bool BALL::ExpressionTree::negate_ [protected] |
ExpressionPredicate* BALL::ExpressionTree::predicate_ [protected] |
Type BALL::ExpressionTree::type_ [protected] |