- int i = 0; // index in AP\r
- while (clock < lengthIP) {\r
- if (samePatterns(inputPattern,clock,admittance,i)) {\r
- clock++;\r
- i++;\r
- }\r
- else {\r
- if (isValidDataGroup(admittance,i)) {\r
- \r
- }\r
- else {\r
- // IP and AP are not equal and AP is a valid group -> not compatible\r
+ int i = 0; // index in AP \r
+ while ((clock < lengthIP) && (i < lengthAP)) {\r
+ \r
+ // if AP is a valid group, search for the next valid group in IP\r
+ if (isValidDataGroup(admittance,i)) {\r
+ while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++;\r
+ if (clock == lengthIP) {\r
+ cerr << "Abnormal case: end of IP has been reached without finding a valid group" << endl;\r