Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

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 () 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.
ExpressionPredicategetPredicate () 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
ExpressionTreeoperator= (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_
ExpressionPredicatepredicate_
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

enum ExpressionTree::Type
 

The type of an expression node in the tree.

The type determines how a node is to be interpreted.

Enumeration values:
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

ExpressionTree::ExpressionTree  )  throw ()
 

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.

ExpressionTree::ExpressionTree const ExpressionTree tree  )  throw ()
 

Copy constructor.

Note that this copy constructor does not copy predicates but only stores pointers to them.

ExpressionTree::ExpressionTree ExpressionPredicate predicate,
bool  negate = false
throw ()
 

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


Member Function Documentation

void ExpressionTree::appendChild const ExpressionTree child  )  throw ()
 

Append a child to the tree.

const list<const ExpressionTree*>& ExpressionTree::getChildren  )  const throw ()
 

Get the list of children.

bool ExpressionTree::getNegate  )  const throw ()
 

Get the expression node's negation mode.

ExpressionPredicate* ExpressionTree::getPredicate  )  const throw ()
 

Get the predicate.

virtual bool ExpressionTree::operator() const Atom atom  )  const throw () [virtual]
 

Evaluate the (sub)expression.

void ExpressionTree::setNegate bool  negate  )  throw ()
 

Set the expression node's negation mode.

void ExpressionTree::setPredicate ExpressionPredicate predicate  )  throw ()
 

Set the predicate.

void ExpressionTree::setType Type  type  )  throw ()
 

Set the expression node's type.