BALL::ExpressionTree Class Reference
[Miscellaneous]

#include <BALL/KERNEL/expressionTree.h>

List of all members.

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)
ExpressionPredicategetPredicate () const
void appendChild (const ExpressionTree *child)
const list< const
ExpressionTree * > & 
getChildren () const
Assignment

ExpressionTreeoperator= (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_
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

Definition at line 25 of file expressionTree.h.


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.

Definition at line 38 of file expressionTree.h.


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
BALL::ExpressionTree::ExpressionTree ( Type  type,
list< const ExpressionTree * >  children,
bool  negate = false 
)
virtual BALL::ExpressionTree::~ExpressionTree (  )  [virtual]

Destructor


Member Function Documentation

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

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

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.


Member Data Documentation

Definition at line 180 of file expressionTree.h.

Definition at line 172 of file expressionTree.h.

Definition at line 176 of file expressionTree.h.

Definition at line 168 of file expressionTree.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3