summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/yap/example/autodiff_library/Edge.cpp
blob: 4a7183b622f87ed9142c6f31fa41f80eeb809d6c (plain)
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
/*
 * 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 */