diff options
author | Carlo Zancanaro <carlo@carlo-laptop> | 2012-10-23 15:16:31 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@carlo-laptop> | 2012-10-23 15:16:31 +1100 |
commit | 3002319eb5fd6b3eff0ffa764534bb571536a08c (patch) | |
tree | c2f79591a54aff370b34717ebf50358f62d4bda4 /impl/Expression.hpp | |
parent | a1b28d756fe52a53d9d4da4d23853969fd529115 (diff) | |
parent | 14c0c8bb717a668084cae8cd4b359ffd6fca73b0 (diff) |
Merge branch 'master' of https://bitbucket.org/czan/honours
Conflicts:
.gitignore
impl/MaxStrategy.hpp
impl/VariableAssignment.hpp
impl/systems/test.eqns
impl/test/7.eqns
Diffstat (limited to 'impl/Expression.hpp')
-rw-r--r-- | impl/Expression.hpp | 14 |
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; } |