BALL::ExpressionTree Class Reference
[Miscellaneous]

Expression tree class. More...

#include <expressionTree.h>

List of all members.


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_

Detailed Description

Expression tree class.

Represents the logical tree of an Expression. This is the backend of Expression.

See also:
Expression

Member Enumeration Documentation

The type of an expression node in the tree.

The type determines how a node is to be interpreted.

Enumerator:
INVALID The node is invalid.
LEAF The node is a leaf.
OR The node is a logical OR conjunction.
AND The node is a logical AND conjunction.

Constructor & Destructor Documentation

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.

Parameters:
predicate the node's predicate
negate set to true if the node's predicate should be negated

Generated on Thu Aug 6 18:30:31 2009 for BALL by doxygen 1.5.8