-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphnode.cpp
60 lines (48 loc) · 957 Bytes
/
graphnode.cpp
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
#include "graphedge.h"
#include "graphnode.h"
GraphNode::GraphNode(int id)
{
_id = id;
}
GraphNode::~GraphNode()
{
//// STUDENT CODE
////
// delete _chatBot;
////
//// EOF STUDENT CODE
}
void GraphNode::AddToken(std::string token)
{
_answers.push_back(token);
}
void GraphNode::AddEdgeToParentNode(GraphEdge *edge)
{
_parentEdges.push_back(edge);
}
void GraphNode::AddEdgeToChildNode(GraphEdge *edge)
{
_childEdges.push_back(edge);
}
//// STUDENT CODE
////
void GraphNode::MoveChatbotHere(ChatBot *chatbot)
{
_chatBot = chatbot;
_chatBot->SetCurrentNode(this);
}
void GraphNode::MoveChatbotToNewNode(GraphNode *newNode)
{
newNode->MoveChatbotHere(_chatBot);
_chatBot = nullptr; // invalidate pointer at source
}
////
//// EOF STUDENT CODE
GraphEdge *GraphNode::GetChildEdgeAtIndex(int index)
{
//// STUDENT CODE
////
return _childEdges[index];
////
//// EOF STUDENT CODE
}