-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.cpp
More file actions
73 lines (57 loc) · 1.59 KB
/
Edge.cpp
File metadata and controls
73 lines (57 loc) · 1.59 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// Created by luise on 5/3/2020.
//
#include "Edge.h"
#include <utility>
Edge::Edge() : vertexA(""), vertexB(""), weight(0), visitedFlag(false){
}
Edge::Edge(string newVertex) : vertexA(move(newVertex)), vertexB(""), weight(0), visitedFlag(false){
}
Edge::Edge(string nodeA, string nodeB, int weight, bool hasVisited) : vertexA(move(nodeA)) , vertexB(move(nodeB)){
this->weight = weight;
this->visitedFlag = hasVisited;
}
Edge::Edge(const Edge& originalVertex){
*this = originalVertex;
}
Edge* Edge::operator=(const Edge* originalVertex){
setVertexNode_A(originalVertex->vertexA);
setVertexNode_B(originalVertex->vertexB);
setWeight(originalVertex->weight);
setVisitedFlag(originalVertex->visitedFlag);
return this;
}
Edge& Edge::operator=(const Edge& originalVertex){
setVertexNode_A(originalVertex.vertexA);
setVertexNode_B(originalVertex.vertexB);
setWeight(originalVertex.weight);
setVisitedFlag(originalVertex.visitedFlag);
return *this;
}
void Edge::setVertexNode_A(string newVertexA){
this->vertexA = move(newVertexA);
}
void Edge::setVertexNode_B(string newVertexB){
this->vertexB = move(newVertexB);
}
void Edge::setWeight(int newWeight){
this->weight = newWeight;
}
void Edge::setVisitedFlag(bool newVisitedFlag){
this->visitedFlag = newVisitedFlag;
}
string Edge::getVertexNode_A(){
return vertexA;
}
string Edge::getVertexNode_B(){
return vertexB;
}
int Edge::getWeight(){
return weight;
}
bool Edge::getVisitedFlag(){
return visitedFlag;
}
void Edge::addVertex(string newVertex){
vertices.push_back(newVertex);
}