summaryrefslogtreecommitdiff
path: root/impl/Equation.h
diff options
context:
space:
mode:
Diffstat (limited to 'impl/Equation.h')
-rw-r--r--impl/Equation.h47
1 files changed, 0 insertions, 47 deletions
diff --git a/impl/Equation.h b/impl/Equation.h
deleted file mode 100644
index b861768..0000000
--- a/impl/Equation.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef EQUATION_H
-#define EQUATION_H
-
-#include "Variable.h"
-#include "Expression.h"
-#include <map>
-#include <string>
-
-template<class T>
-struct Equation {
- Equation(const Variable<T>& var, Expression<T>* value)
- : _var(var), _value(value) { }
-
- Variable<T> var() const {
- return _var;
- }
- Variable<T> var(const Variable<T>& var) {
- Variable<T> old_var = _var;
- _var = var;
- return _var;
- }
-
- Expression<T>* value() const {
- return _value;
- }
- Expression<T>* value(const Expression<T>* value) {
- Expression<T>* old_value = _value;
- _value = value;
- return old_value;
- }
-
- std::map<std::string, T> solve(const std::map<std::string, T>& curr) {
- std::map<std::string, T> result = curr;
- T last;
- do {
- last = result[_var.name()];
- result[_var.name()] = _value->eval(result);
- } while (last != result[_var.name()]);
- return result;
- }
-
- private:
- Variable<T> _var;
- Expression<T>* _value;
-};
-
-#endif