← Documentation
ADS-IDAC Engine 5.0.0
StringTimeIntervalUnit.cpp
Go to the documentation of this file.
1// StringTimeIntervalUnit.cpp: implementation of the StringTimeIntervalUnit class.
2//
4
6#include "ReasonMachine.h"
7using namespace std;
8
10// Construction/Destruction
12
14{
15 this->m_interrupted_bl = false;
16}
17
19{
20
21}
22
24{
25 this->m_interval_start = _unit_pt->m_interval_start;
26 this->m_interval_end = _unit_pt->m_interval_end;
27 this->m_name = _unit_pt->m_name;
28 this->m_interrupted_bl = _unit_pt->m_interrupted_bl;
29 vector<string>::iterator str_itr;
30 if(this->m_thought_line_list.size() != 0)
31 {this->ErrorMessage("this->m_thought_line_list.size() != 0"); return;}
32
33 for(str_itr = _unit_pt->m_thought_line_list.begin(); str_itr != _unit_pt->m_thought_line_list.end(); str_itr ++)
34 {
35 this->m_thought_line_list.push_back(*str_itr);
36 }
37}
38
40{
41 cout << r5pars_.timesno << " " << str << " in ReasonMachine.cpp" << '\n';
42 ofstream fout("err messages.txt", ios::app);
43 fout << r5pars_.timesno << " " << str << '\n';
44 fout.close();
45 //r5pars_.terminateall = true;
46}
47
49{
50 //return true means they have the same list;
51 //return false means that they have different lists;
52
53 bool equal_bl = false;
54 vector<string>::iterator str_itr1;
55 vector<string>::iterator str_itr2;
56
57 if(this->m_thought_line_list.size() != _unit_pt->m_thought_line_list.size())
58 {equal_bl = false; return false;}
59
60 str_itr1 = this->m_thought_line_list.begin();
61 str_itr2 = _unit_pt->m_thought_line_list.begin();
62
63 while(str_itr1 != this->m_thought_line_list.end())
64 {
65 if((*str_itr1).compare(*str_itr2) != 0)
66 {
67 equal_bl = false;
68 return false;
69 }
70 str_itr1++;
71 str_itr2++;
72 }
73 return true;
74}
75
77{
78 Investigator * invest_pt;
79 InvestigatorLink * link_pt;
80 vector<string>::iterator str_itr1;
81 vector<string>::iterator str_itr2;
82 bool contain_bl = false;
83
84 for(str_itr1 = this->m_thought_line_list.begin(); str_itr1 != this->m_thought_line_list.end(); str_itr1++)
85 {
86 if(_ID_pt->m_ID.compare(*str_itr1) == 0)
87 {
88 contain_bl = true; return true;
89 }
90 }
91
92 if(_ID_pt->m_ID_Type == 301)
93 {
94 invest_pt = (Investigator*)_ID_pt;
95 for(str_itr1 = this->m_thought_line_list.begin(); str_itr1 != this->m_thought_line_list.end(); str_itr1++)
96 {
97 for(str_itr2 = invest_pt->m_thoughtline_roots_list.begin(); str_itr2 != invest_pt->m_thoughtline_roots_list.end(); str_itr2++)
98 {
99 if((*str_itr2).compare(*str_itr1) == 0)
100 {
101 contain_bl = true; return true;
102 }
103 }
104 }
105
106 }
107 else if(_ID_pt->m_ID_Type == 302)
108 {
109 link_pt = (InvestigatorLink *)_ID_pt;
110 for(str_itr1 = this->m_thought_line_list.begin(); str_itr1 != this->m_thought_line_list.end(); str_itr1++)
111 {
112 for(str_itr2 = link_pt->m_thoughtline_roots_list.begin(); str_itr2 != link_pt->m_thoughtline_roots_list.end(); str_itr2++)
113 {
114 if((*str_itr2).compare(*str_itr1) == 0)
115 {
116 contain_bl = true; return true;
117 }
118 }
119 }
120
121 }
122
123 return contain_bl;
124}
Diagnostic reasoning engine — knowledge representation, mental model, and inference.
int m_ID_Type
Definition: IDElement.h:15
std::string m_ID
Definition: IDElement.h:16
std::vector< std::string > m_thoughtline_roots_list
Definition: Investigator.h:84
std::vector< std::string > m_thought_line_list
bool CheckWhetherContainsAnItemInTheThoughtLine(IDElement *)
bool CompareThisUnitWithAnotherStringTimeIntervalUnitOnThoughtLineList(StringTimeIntervalUnit *)
void CopyFromAnotherStringTimeIntervalUnit(StringTimeIntervalUnit *)
struct @0 r5pars_