23 std::string& rReportStr)
25 FD_DF(
"IsHioPlantForm("<< rHioPlant.
Name() <<
",...)");
33 rErrEvSet.
Name(
"rErrEvSet");
36 rErrTrSet.
Name(
"rErrTrSet");
39 rErrStSet.
Name(
"rErrStSet");
48 bool finalResult =
true;
50 bool localResult =
true;
62 EventSet::Iterator evit;
63 StateSet::Iterator sit;
67 rReportStr.append(
"#########################################################\n");
68 rReportStr.append(
"########## IsHioPlantForm("+rHioPlant.
Name()+
",...) - test results:\n");
73 rReportStr.append(
"##### fail: generator is not deterministic!\n");
74 if(initStates.
Size()>1) {
75 rErrStSet = initStates;
76 rReportStr.append(
"##### (amongst others, there is more than one initial state)\n");
81 rReportStr.append(
"#####\n");
87 rReportStr.append(
"########## Condition (i):\n");
91 rReportStr.append(
"##### fail: empty YP alphabet.\n");
96 rReportStr.append(
"##### fail: empty UP alphabet.\n");
101 rReportStr.append(
"##### fail: empty YE alphabet.\n");
106 rReportStr.append(
"##### fail: empty UE alphabet.\n");
119 if(!rErrEvSet.
Empty()){
120 rReportStr.append(
"##### fail: found events with missing or ambiguous attribute, see rErrEvSet:\n");
121 rReportStr.append(rErrEvSet.
ToString()+
"\n");
122 rReportStr.append(
"##### Condition (i) failed.\n");
123 rReportStr.append(
"########## Termination due to crucial failure. ##########\n");
124 rReportStr.append(
"#########################################################\n");
127 if(localResult) rReportStr.append(
"##### Condition (i) passed.\n");
128 else rReportStr.append(
"##### Condition (i) failed.\n");
129 rReportStr.append(
"#####\n");
135 rReportStr.append(
"########## Condition (ii):\n");
138 for(sit = accessibleStates.
Begin(); sit != accessibleStates.
End(); ++sit) {
143 bool goodState =
true;
147 if(activeEv.
Empty()) {
155 evit = activeEv.
Begin();
156 isY = rHioPlant.
IsY(*evit);
157 isUp = rHioPlant.
IsUp(*evit);
158 isUe = rHioPlant.
IsUe(*evit);
160 for(; evit != activeEv.
End(); evit++) {
161 if( (isY && !rHioPlant.
IsY(*evit)) ||
162 (isUp && !rHioPlant.
IsUp(*evit)) ||
163 (isUe && !rHioPlant.
IsUe(*evit)) ) {
176 if(!goodState)
continue;
194 if(localResult) rReportStr.append(
"##### Condition (ii) passed.\n");
197 rReportStr.append(
"##### fail: found states with undecidable attribute:\n");
198 rReportStr.append(locErrStSet.
ToString()+
"\n");
200 rReportStr.append(
"##### Condition (ii) failed.\n");
201 rReportStr.append(
"########## Termination due to crucial failure. ##########\n");
202 rReportStr.append(
"###################### No success. ######################\n");
203 rReportStr.append(
"#########################################################\n");
206 rReportStr.append(
"#####\n");
212 rReportStr.append(
"########## Condition (iii):\n");
215 if(!(initStates <= rQYpYe)) {
216 rReportStr.append(
"##### fail: some init state(s) is (are) not a QYpYe-state:\n");
217 locErrStSet=initStates-rQYpYe;
219 rReportStr.append(locErrStSet.
ToString()+
"\n");
224 if(localResult) rReportStr.append(
"##### Condition (iii) passed.\n");
225 else rReportStr.append(
"##### Condition (iii) failed.\n");
226 rReportStr.append(
"#####\n");
233 rReportStr.append(
"########## Condition (iv):\n");
237 for(sit = rQYpYe.
Begin(); sit != rQYpYe.
End(); ++sit) {
240 if( (rHioPlant.
IsYp(tit->Ev) && !(rQUp.
Exists(tit->X2) || rQUe.
Exists(tit->X2)))) {
250 if(localResult) rReportStr.append(
"##### Condition (iv) passed.\n");
252 rReportStr.append(
"##### fail: found YP- or YE-transitions leading to wrong states:\n");
253 rReportStr.append(locErrTrSet.
ToString()+
"\n");
255 rReportStr.append(
"##### Condition (iv) failed.\n");
257 rReportStr.append(
"#####\n");
263 rReportStr.append(
"########## Condition (v):\n");
266 for(sit = rQUp.
Begin(); sit != rQUp.
End(); ++sit) {
268 if(!rQYpYe.
Exists(tit->X2)) {
277 if(localResult) rReportStr.append(
"##### Condition (v) passed.\n");
279 rReportStr.append(
"##### fail: found UP-transitions leading to wrong states:\n");
280 rReportStr.append(locErrTrSet.
ToString()+
"\n");
282 rReportStr.append(
"##### Condition (v) failed.\n");
284 rReportStr.append(
"#####\n");
290 rReportStr.append(
"########## Condition (vi):\n");
293 for(sit = rQUe.
Begin(); sit != rQUe.
End(); ++sit) {
295 if(!rQYpYe.
Exists(tit->X2)) {
304 if(localResult) rReportStr.append(
"##### Condition (vi) passed.\n");
306 rReportStr.append(
"##### fail: found UE-transitions leading to wrong states:\n");
307 rReportStr.append(locErrTrSet.
ToString()+
"\n");
309 rReportStr.append(
"##### Condition (vi) failed.\n");
311 rReportStr.append(
"#####\n");
317 rReportStr.append(
"########## Condition (vii):\n");
320 for(sit = rQUp.
Begin(); sit != rQUp.
End(); ++sit) {
330 if(localResult) rReportStr.append(
"##### Condition (vii) passed.\n");
332 rReportStr.append(
"##### fail: found QUp-states with inactive UP-events:\n");
333 rReportStr.append(locErrStSet.
ToString()+
"\n");
335 rReportStr.append(
"##### Condition (vii) failed.\n");
337 rReportStr.append(
"#####\n");
343 rReportStr.append(
"########## Condition (viii):\n");
346 for(sit = rQUe.
Begin(); sit != rQUe.
End(); ++sit) {
356 if(localResult) rReportStr.append(
"##### Condition (viii) passed.\n");
358 rReportStr.append(
"##### fail: found QUe-states with inactive UE-events:\n");
359 rReportStr.append(locErrStSet.
ToString()+
"\n");
361 rReportStr.append(
"##### Condition (viii) failed.\n");
363 rReportStr.append(
"#####\n");
391 rReportStr.append(
"########## Condition (x):\n");
396 rReportStr.append(
"##### warning: non-accessible states have been removed.\n");
397 rReportStr.append(
"##### Condition (x) repaired.\n");
399 else rReportStr.append(
"##### Condition (x) passed.\n");
406 rReportStr.append(
"##################### Final result: #####################\n");
408 rReportStr.append(
"############## Generator is in HioPlantForm. ##############\n");
409 rReportStr.append(
"#########################################################\n");
413 rReportStr.append(
"############ Generator is NOT in HioPlantForm. ###########\n");
414 rReportStr.append(
"#########################################################\n");
429 return IsHioPlantForm(rHioPlant, QYpYe, QUp, QUe, ErrEvSet, ErrTrSet, ErrStSet,rReportStr);
439 std::string ReportStr;
441 return IsHioPlantForm(rHioPlant, QYpYe, QUp, QUe, ErrEvSet, ErrTrSet, ErrStSet,ReportStr);
bool IsUp(Idx index) const
EventSet EEvents(void) const
bool IsUe(Idx index) const
bool IsY(Idx index) const
EventSet UeEvents(void) const
EventSet UpEvents(void) const
bool IsYp(Idx index) const
EventSet PEvents(void) const
EventSet YpEvents(void) const
EventSet YeEvents(void) const
bool Insert(const Transition &rTransition)
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
const TaEventSet< EventAttr > & Alphabet(void) const
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
EventSet ActiveEventSet(Idx x1) const
const StateSet & InitStates(void) const
TransSet::Iterator TransRelBegin(void) const
bool IsAccessible(void) const
StateSet AccessibleSet(void) const
void Name(const std::string &rName)
TransSet::Iterator TransRelEnd(void) const
bool IsDeterministic(void) const
bool Exists(const T &rElem) const
virtual void InsertSet(const TBaseSet &rOtherSet)
Iterator Begin(void) const
const std::string & Name(void) const
void HioStatePartition(HioConstraint &rHioConstraint)
bool IsHioPlantForm(HioPlant &rHioPlant, StateSet &rQYpYe, StateSet &rQUp, StateSet &rQUe, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr)