/usr/include/BALL/KERNEL/expressionTree.h is in libball1.4-dev 1.4.3~beta1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: expressionTree.h,v 1.12 2005/10/23 12:02:18 oliver Exp $
//
#ifndef BALL_KERNEL_EXPRESSIONTREE_H
#define BALL_KERNEL_EXPRESSIONTREE_H
#ifndef BALL_KERNEL_EXPRESSIONPREDICATE_H
# include <BALL/KERNEL/expressionPredicate.h>
#endif
namespace BALL
{
/** Expression tree class.
Represents the logical tree of an Expression. This is the backend of
Expression.
\par
@see Expression
\ingroup KernelMiscellaneous
*/
class BALL_EXPORT ExpressionTree
{
public:
BALL_CREATE(ExpressionTree)
/** @name Type Definitions
*/
//@{
/** The type of an expression node in the tree.
The type determines how a node is to be interpreted.
*/
enum Type
{
/// The node is invalid.
INVALID = 0,
/// The node is a leaf.
LEAF,
/// The node is a logical OR conjunction.
OR,
/// The node is a logical AND conjunction.
AND
};
//@}
/** @name Constructors and Destructor
*/
//@{
/** Default constructor.
Create an empty expression node. The node's type is set to INVALID,
<tt>negate_</tt> is set to <b>false</b>, the internal predicate is set
to 0, and the list of children is empty.
*/
ExpressionTree();
/** Copy constructor. Note that this copy constructor does not copy
predicates but only stores pointers to them.
*/
ExpressionTree(const ExpressionTree& tree);
/** Detailed constructor.
Create an expression node representing a leaf, i.e., a
predicate.
@param predicate the node's predicate
@param negate set to <b>true</b> if the node's predicate should be
negated
*/
ExpressionTree(ExpressionPredicate* predicate, bool negate = false);
/**
*/
ExpressionTree(Type type, list<const ExpressionTree*> children, bool negate = false);
/** Destructor
*/
virtual ~ExpressionTree();
//@}
/** @name Predicates
*/
//@{
/** Evaluate the (sub)expression.
*/
virtual bool operator () (const Atom& atom) const;
/** Equality operator
*/
bool operator == (const ExpressionTree& tree) const;
/** Inequality operator
*/
bool operator != (const ExpressionTree& tree) const;
//@}
/** @name Accessors
*/
//@{
/** Set the expression node's type.
*/
void setType(Type type) ;
/** Get the expression node's type
*/
Type getType() const;
/** Set the expression node's negation mode.
*/
void setNegate(bool negate);
/** Get the expression node's negation mode.
*/
bool getNegate() const;
/** Set the predicate.
*/
void setPredicate(ExpressionPredicate* predicate);
/** Get the predicate.
*/
ExpressionPredicate* getPredicate() const;
/** Append a child to the tree.
*/
void appendChild(const ExpressionTree* child);
/** Get the list of children.
*/
const list<const ExpressionTree*>& getChildren() const;
//@}
/** @name Assignment
*/
//@{
/** Asignment operator
*/
ExpressionTree& operator = (const ExpressionTree& tree);
/** Clear method
*/
virtual void clear();
//@}
/** @name Debugging
*/
//@{
void dump(std::ostream& is = std::cout, Size depth = 0) const;
//@}
protected:
/*_ A helper function for operator == () that compares the children of
a node.
*/
bool compareChildren_(const ExpressionTree& tree) const;
/*_ The type of this node.
*/
Type type_;
/*_ Negation flag. If set, the value of this node will be negated.
*/
bool negate_;
/*_ A pointer to the predicate that this node represents.
*/
ExpressionPredicate* predicate_;
/*_ A list containing pointers to the children of this node.
*/
list<const ExpressionTree*> children_;
};
}
#endif // BALL_KERNEL_EXPRESSIONTREE_H
|