diff options
Diffstat (limited to 'src/boost/libs/yap/example/autodiff_library/Edge.cpp')
-rw-r--r-- | src/boost/libs/yap/example/autodiff_library/Edge.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/boost/libs/yap/example/autodiff_library/Edge.cpp b/src/boost/libs/yap/example/autodiff_library/Edge.cpp new file mode 100644 index 00000000..4a7183b6 --- /dev/null +++ b/src/boost/libs/yap/example/autodiff_library/Edge.cpp @@ -0,0 +1,54 @@ +/* + * Edge.cpp + * + * Created on: 12 Nov 2013 + * Author: s0965328 + */ + +#include "Edge.h" +#include <iostream> +#include <sstream> + +namespace AutoDiff { + +Edge::Edge(Node* a_,Node* b_):a(a_),b(b_) { + +} + +Edge::~Edge() { + a = NULL; + b = NULL; +} + +Edge::Edge(const Edge& e) +{ + a = e.a; + b = e.b; +} + +bool Edge::isEqual(Edge* e) +{ + if(e->a == a && e->b == b) + { + return true; + } + else if(e->b == a && e->a == b) + { + return true; + } + return false; +} + +bool Edge::isEqual(Edge& e) +{ + return isEqual(&e); +} + +string Edge::toString() +{ + ostringstream oss; + oss<<""<<a->toString(0)<<"|"<<a<<" ----- "<<b->toString(0)<<"|"<<b<<""<<endl; + return oss.str(); +} + +} /* namespace AutoDiff */ |