BALL 1.5.0
Loading...
Searching...
No Matches
expressionTree.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: expressionTree.h,v 1.12 2005/10/23 12:02:18 oliver Exp $
5//
6
7#ifndef BALL_KERNEL_EXPRESSIONTREE_H
8#define BALL_KERNEL_EXPRESSIONTREE_H
9
10#ifndef BALL_KERNEL_EXPRESSIONPREDICATE_H
12#endif
13
14namespace BALL
15{
16
26 {
27 public:
28
30
31
34
35
38 enum Type
39 {
41 INVALID = 0,
47 AND
48 };
50
54
61
66
74 ExpressionTree(ExpressionPredicate* predicate, bool negate = false);
75
78 ExpressionTree(Type type, list<const ExpressionTree*> children, bool negate = false);
79
82 virtual ~ExpressionTree();
83
85
88
91 virtual bool operator () (const Atom& atom) const;
92
95 bool operator == (const ExpressionTree& tree) const;
96
99 bool operator != (const ExpressionTree& tree) const;
100
102
105
108 void setType(Type type) ;
109
112 Type getType() const;
113
116 void setNegate(bool negate);
117
120 bool getNegate() const;
121
125
129
132 void appendChild(const ExpressionTree* child);
133
136 const list<const ExpressionTree*>& getChildren() const;
137
139
142
145 ExpressionTree& operator = (const ExpressionTree& tree);
146
149 virtual void clear();
150
152
155 void dump(std::ostream& is = std::cout, Size depth = 0) const;
157
158
159 protected:
160
161 /*_ A helper function for operator == () that compares the children of
162 a node.
163 */
164 bool compareChildren_(const ExpressionTree& tree) const;
165
166 /*_ The type of this node.
167 */
169
170 /*_ Negation flag. If set, the value of this node will be negated.
171 */
173
174 /*_ A pointer to the predicate that this node represents.
175 */
177
178 /*_ A list containing pointers to the children of this node.
179 */
180 list<const ExpressionTree*> children_;
181
182 };
183
184}
185
186#endif // BALL_KERNEL_EXPRESSIONTREE_H
#define BALL_CREATE(name)
Definition create.h:62
void setType(Type type)
virtual void clear()
ExpressionTree(Type type, list< const ExpressionTree * > children, bool negate=false)
void dump(std::ostream &is=std::cout, Size depth=0) const
void setNegate(bool negate)
virtual ~ExpressionTree()
void appendChild(const ExpressionTree *child)
Type getType() const
@ LEAF
The node is a leaf.
@ OR
The node is a logical OR conjunction.
bool compareChildren_(const ExpressionTree &tree) const
ExpressionPredicate * getPredicate() const
bool getNegate() const
list< const ExpressionTree * > children_
void setPredicate(ExpressionPredicate *predicate)
const list< const ExpressionTree * > & getChildren() const
ExpressionTree(const ExpressionTree &tree)
ExpressionTree(ExpressionPredicate *predicate, bool negate=false)
ExpressionPredicate * predicate_
#define BALL_EXPORT