24 std::string& rReportStr)
26 FD_DF(
"IsHioEnvironmentForm("<< rHioEnvironment.
Name() <<
",...)");
35 rErrEvSet.
Name(
"rErrEvSet");
38 rErrTrSet.
Name(
"rErrTrSet");
41 rErrStSet.
Name(
"rErrStSet");
50 bool finalResult =
true;
52 bool localResult =
true;
65 EventSet::Iterator evit;
66 StateSet::Iterator sit;
70 rReportStr.append(
"#########################################################\n");
71 rReportStr.append(
"########## IsHioEnvironmentForm("+rHioEnvironment.
Name()+
",...) - test results:\n");
76 rReportStr.append(
"##### fail: generator is not deterministic!\n");
77 if(initStates.
Size()>1) {
78 rErrStSet = initStates;
79 rReportStr.append(
"##### (amongst others, there is more than one initial state)\n");
85 rReportStr.append(
"#####\n");
91 rReportStr.append(
"########## Condition (i):\n");
95 rReportStr.append(
"##### fail: empty YE alphabet.\n");
100 rReportStr.append(
"##### fail: empty UE alphabet.\n");
105 rReportStr.append(
"##### fail: empty YL alphabet.\n");
110 rReportStr.append(
"##### fail: empty UL alphabet.\n");
123 if(!rErrEvSet.
Empty()){
124 rReportStr.append(
"##### fail: found events with missing or ambiguous attribute:\n");
125 rReportStr.append(rErrEvSet.
ToString()+
"\n");
126 rReportStr.append(
"##### Condition (i) failed.\n");
127 rReportStr.append(
"########## Termination due to crucial failure. ##########\n");
128 rReportStr.append(
"#########################################################\n");
131 if(localResult) rReportStr.append(
"##### Condition (i) passed.\n");
132 else rReportStr.append(
"##### Condition (i) failed.\n");
133 rReportStr.append(
"#####\n");
139 rReportStr.append(
"########## Condition (ii):\n");
143 for(sit = accessibleStates.
Begin(); sit != accessibleStates.
End(); ++sit) {
149 bool goodState =
true;
153 if(activeEv.
Empty()) {
160 evit = activeEv.
Begin();
161 isUl = rHioEnvironment.
IsUl(*evit);
162 isYlUe = rHioEnvironment.
IsYl(*evit);
163 isUe = rHioEnvironment.
IsUe(*evit);
164 isYe = rHioEnvironment.
IsYe(*evit);
166 for(; evit != activeEv.
End(); evit++) {
167 if( (isUl && !rHioEnvironment.
IsUl(*evit)) ||
168 ((isYlUe||isUe) && (!rHioEnvironment.
IsYl(*evit) && (!rHioEnvironment.
IsUe(*evit)))) ||
169 (isYe && !rHioEnvironment.
IsYe(*evit)) ){
178 if(isUe && rHioEnvironment.
IsYl(*evit)) {
186 if(!goodState)
continue;
191 rHioEnvironment.
SetQUl(*sit);
199 rHioEnvironment.
SetQUe(*sit);
203 rHioEnvironment.
SetQYe(*sit);
208 if(localResult) rReportStr.append(
"##### Condition (ii) passed.\n");
211 rReportStr.append(
"##### fail: found states with undecidable attribute:\n");
212 rReportStr.append(locErrStSet.
ToString()+
"\n");
214 rReportStr.append(
"##### Condition (ii) failed.\n");
215 rReportStr.append(
"########## Termination due to crulial failure. ##########\n");
216 rReportStr.append(
"###################### No sulcess. ######################\n");
217 rReportStr.append(
"#########################################################\n");
220 rReportStr.append(
"#####\n");
226 rReportStr.append(
"########## Condition (iii):\n");
229 if(!(initStates <= rQYe)) {
230 rReportStr.append(
"##### fail: some init state(s) is (are) not a QYe-state:\n");
231 locErrStSet=initStates-rQYe;
232 rReportStr.append(locErrStSet.
ToString()+
"\n");
238 if(localResult) rReportStr.append(
"##### Condition (iii) passed.\n");
239 else rReportStr.append(
"##### Condition (iii) failed.\n");
240 rReportStr.append(
"#####\n");
247 rReportStr.append(
"########## Condition (iv):\n");
250 for(sit = rQYe.
Begin(); sit != rQYe.
End(); ++sit) {
253 if ( !( rQYlUe.
Exists(tit->X2) || rQUe.
Exists(tit->X2) ) ) {
263 if(localResult) rReportStr.append(
"##### Condition (iv) passed.\n");
265 rReportStr.append(
"##### fail: found YE-transitions leading to wrong states:\n");
266 rReportStr.append(locErrTrSet.
ToString()+
"\n");
268 rReportStr.append(
"##### Condition (iv) failed.\n");
270 rReportStr.append(
"#####\n");
276 rReportStr.append(
"########## Condition (v):\n");
279 for(sit = rQUe.
Begin(); sit != rQUe.
End(); ++sit) {
281 if(!rQYe.
Exists(tit->X2)) {
290 if(localResult) rReportStr.append(
"##### Condition (v) passed.\n");
292 rReportStr.append(
"##### fail: found UE-transitions leading to wrong states:\n");
293 rReportStr.append(locErrTrSet.
ToString()+
"\n");
295 rReportStr.append(
"##### Condition (v) failed.\n");
297 rReportStr.append(
"#####\n");
303 rReportStr.append(
"########## Condition (vi):\n");
307 for(sit = rQYlUe.
Begin(); sit != rQYlUe.
End(); ++sit) {
310 if( (rHioEnvironment.
IsUe(tit->Ev) && !rQYe.
Exists(tit->X2)) ||
311 (rHioEnvironment.
IsYl(tit->Ev) && !rQUl.
Exists(tit->X2)) ){
320 if(localResult) rReportStr.append(
"##### Condition (vi) passed.\n");
322 rReportStr.append(
"##### fail: found YL- or UE-transitions leading to wrong states:\n");
323 rReportStr.append(locErrTrSet.
ToString()+
"\n");
325 rReportStr.append(
"##### Condition (vi) failed.\n");
327 rReportStr.append(
"#####\n");
333 rReportStr.append(
"########## Condition (vii):\n");
336 for(sit = rQUl.
Begin(); sit != rQUl.
End(); ++sit) {
338 if(!rQUe.
Exists(tit->X2)) {
347 if(localResult) rReportStr.append(
"##### Condition (vii) passed.\n");
349 rReportStr.append(
"##### fail: found UL-transitions leading to wrong states, see rErrTrSet:\n");
350 rReportStr.append(locErrTrSet.
ToString()+
"\n");
352 rReportStr.append(
"##### Condition (vii) failed.\n");
354 rReportStr.append(
"#####\n");
360 rReportStr.append(
"########## Condition (viii):\n");
363 for(sit = rQUl.
Begin(); sit != rQUl.
End(); ++sit) {
373 if(localResult) rReportStr.append(
"##### Condition (viii) passed.\n");
375 rReportStr.append(
"##### fail: found QUl-states with inactive UL-events:\n");
376 rReportStr.append(locErrStSet.
ToString()+
"\n");
378 rReportStr.append(
"##### Condition (viii) failed.\n");
380 rReportStr.append(
"#####\n");
386 rReportStr.append(
"########## Condition (ix):\n");
389 for(sit = rQYe.
Begin(); sit != rQYe.
End(); ++sit) {
399 if(localResult) rReportStr.append(
"##### Condition (ix) passed.\n");
401 rReportStr.append(
"##### fail: found QYe-states with inactive YE-events:\n");
402 rReportStr.append(locErrStSet.
ToString()+
"\n");
404 rReportStr.append(
"##### Condition (ix) failed.\n");
406 rReportStr.append(
"#####\n");
412 rReportStr.append(
"########## Condition (x):\n");
415 if(!(accessibleStates<=rHioEnvironment.
MarkedStates())) {
420 if(localResult) rReportStr.append(
"##### Condition (x) passed.\n");
422 rReportStr.append(
"##### fail: not all accessible states are marked, see rErrStSet:\n");
423 locErrStSet= accessibleStates - rHioEnvironment.
MarkedStates();
425 rReportStr.append(locErrStSet.
ToString()+
"\n");
427 rReportStr.append(
"##### Condition (x) failed.\n");
429 rReportStr.append(
"#####\n");
435 rReportStr.append(
"########## Condition (xi):\n");
438 if(!deadEnds.
Empty()) {
442 rReportStr.append(
"##### fail: found dead ends:\n");
443 rReportStr.append(deadEnds.
ToString()+
"\n");
445 rReportStr.append(
"##### Condition (xi) failed.\n");
447 rReportStr.append(
"##### Condition (xi) passed.\n");
452 rReportStr.append(
"########## Condition (xii):\n");
457 rReportStr.append(
"##### warning: non-accessible states have been removed.\n");
458 rReportStr.append(
"##### Condition (xii) repaired.\n");
460 else rReportStr.append(
"##### Condition (xii) passed.\n");
466 rReportStr.append(
"##################### Final result: #####################\n");
468 rReportStr.append(
"######### Generator is in HioEnvironmentForm. #########\n");
469 rReportStr.append(
"#########################################################\n");
473 rReportStr.append(
"########### Generator is NOT in HioEnvironmentForm. ###########\n");
474 rReportStr.append(
"#########################################################\n");
489 return IsHioEnvironmentForm(rHioEnvironment, QYe, QUe, QUl, QYlUe, ErrEvSet, ErrTrSet, ErrStSet, rReportStr);
499 std::string ReportStr;
501 return IsHioEnvironmentForm(rHioEnvironment, QYe, QUe, QUl, QYlUe, ErrEvSet, ErrTrSet, ErrStSet, ReportStr);
#define FD_DF(message)
Debug: optional report on user functions.
Idx Insert(void)
Insert new index to set.
Set of indices with symbolic names.
void SetQUe(Idx index)
Mark event as QUe-state (by index)
void SetQYe(Idx index)
Mark event as QYe-state (by index)
EventSet UeEvents(void) const
Get EventSet with Ue-events.
bool IsUl(Idx index) const
Is event Ul-event (by index)
EventSet YeEvents(void) const
Get EventSet with Ye-events.
bool IsYe(Idx index) const
Is event Ye-event(by index)
EventSet LEvents(void) const
Get EventSet with E-events.
bool IsYl(Idx index) const
Is event Yl-event (by index)
void SetQUl(Idx index)
Mark event as QUl-state (by index)
EventSet UlEvents(void) const
Get EventSet with Ul-events.
bool IsUe(Idx index) const
Is event Ue-event(by index)
EventSet YlEvents(void) const
Get EventSet with Yl-events.
EventSet EEvents(void) const
Get EventSet with P-events.
void SetQYlUe(Idx index)
Mark event as QYlUe-state (by index)
bool Insert(const Transition &rTransition)
Add a Transition.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
const TaEventSet< EventAttr > & Alphabet(void) const
Return const reference to alphabet.
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to a string.
const StateSet & MarkedStates(void) const
Return const ref of marked states.
EventSet ActiveEventSet(Idx x1) const
Return active event set at state x1.
const StateSet & InitStates(void) const
Const ref to initial states.
TransSet::Iterator TransRelBegin(void) const
Iterator to Begin() of transition relation.
bool Accessible(void)
Make generator accessible.
bool IsAccessible(void) const
Check if generator is accessible.
StateSet AccessibleSet(void) const
Compute set of accessible states.
void Name(const std::string &rName)
Set the generator's name.
TransSet::Iterator TransRelEnd(void) const
Iterator to End() of transition relation.
bool IsDeterministic(void) const
Check if generator is deterministic.
bool Empty(void) const
Test whether if the TBaseSet is Empty.
bool Exists(const T &rElem) const
Test existence of element.
virtual void Clear(void)
Clear all set.
Iterator End(void) const
Iterator to the end of set.
virtual void InsertSet(const TBaseSet &rOtherSet)
Insert elements given by rOtherSet.
Iterator Begin(void) const
Iterator to the begin of set.
const std::string & Name(void) const
Return name of TBaseSet.
Idx Size(void) const
Get Size of TBaseSet.
Generator with I/O-environment attributes.
libFAUDES resides within the namespace faudes.
bool IsHioEnvironmentForm(HioEnvironment &rHioEnvironment, StateSet &rQYe, StateSet &rQUe, StateSet &rQUl, StateSet &rQYlUe, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr)
IsHioEnvironmentForm: check if rHioEnvironment is in I/O-environment form and assign state attributes...
void HioStatePartition(HioConstraint &rHioConstraint)
Function definition for run-time interface.