summaryrefslogtreecommitdiff
path: root/impl/Expression.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'impl/Expression.hpp')
-rw-r--r--impl/Expression.hpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/impl/Expression.hpp b/impl/Expression.hpp
index 0f3717f..cba9582 100644
--- a/impl/Expression.hpp
+++ b/impl/Expression.hpp
@@ -27,6 +27,10 @@ struct Expression {
return NULL;
}
+ virtual MaxExpression<Domain>* toMaxExpression() {
+ return NULL;
+ }
+
virtual Domain eval(const VariableAssignment<Domain>&) const = 0;
virtual Domain eval(const VariableAssignment<Domain>& rho,
const MaxStrategy<Domain>&) const {
@@ -106,6 +110,10 @@ struct OperatorExpression : public Expression<Domain> {
return _operator.eval(argumentValues);
}
+ std::vector<Expression<Domain>*>& arguments() {
+ return _arguments;
+ }
+
const std::vector<Expression<Domain>*>& arguments() const {
return _arguments;
}
@@ -137,7 +145,7 @@ struct OperatorExpression : public Expression<Domain> {
private:
const Operator<Domain>& _operator;
protected:
- const std::vector<Expression<Domain>*> _arguments;
+ std::vector<Expression<Domain>*> _arguments;
};
template<typename Domain>
@@ -145,6 +153,10 @@ struct MaxExpression : public OperatorExpression<Domain> {
MaxExpression(const unsigned int& id, const Maximum<Domain>& op, const std::vector<Expression<Domain>*>& arguments)
: OperatorExpression<Domain>(op, arguments), _id(id) {}
+ MaxExpression* toMaxExpression() {
+ return this;
+ }
+
const MaxExpression* toMaxExpression() const {
return this;
}