| 295 | |
| 296 | |
| 297 | int |
| 298 | SpaceNode::getNumberOfChildNodes(NodeAllocator& na, |
| 299 | BestNode* curBest, Statistics& stats, |
| 300 | int c_d, int a_d) { |
| 301 | int kids = 0; |
| 302 | if (isUndetermined()) { |
| 303 | stats.undetermined--; |
| 304 | acquireSpace(na, curBest, c_d, a_d); |
| 305 | QVector<QString> labels; |
| 306 | switch (static_cast<Space*>(Support::funmark(copy))->status(stats)) { |
| 307 | case SS_FAILED: |
| 308 | { |
| 309 | purge(na); |
| 310 | kids = 0; |
| 311 | setHasOpenChildren(false); |
| 312 | setHasSolvedChildren(false); |
| 313 | setHasFailedChildren(true); |
| 314 | setStatus(FAILED); |
| 315 | stats.failures++; |
| 316 | SpaceNode* p = getParent(na); |
| 317 | if (p != nullptr) |
| 318 | p->closeChild(na, true, false); |
| 319 | } |
| 320 | break; |
| 321 | case SS_SOLVED: |
| 322 | { |
| 323 | // Deletes all pending branchers |
| 324 | (void) static_cast<Space*>(Support::funmark(copy))->choice(); |
| 325 | kids = 0; |
| 326 | setStatus(SOLVED); |
| 327 | setHasOpenChildren(false); |
| 328 | setHasSolvedChildren(true); |
| 329 | setHasFailedChildren(false); |
| 330 | stats.solutions++; |
| 331 | if (curBest != nullptr) { |
| 332 | curBest->s = this; |
| 333 | } |
| 334 | SpaceNode* p = getParent(na); |
| 335 | if (p != nullptr) |
| 336 | p->closeChild(na, false, true); |
| 337 | } |
| 338 | break; |
| 339 | case SS_BRANCH: |
| 340 | { |
| 341 | Space* s = static_cast<Space*>(Support::funmark(copy)); |
| 342 | choice = s->choice(); |
| 343 | kids = choice->alternatives(); |
| 344 | setHasOpenChildren(true); |
| 345 | if (dynamic_cast<const StopChoice*>(choice)) { |
| 346 | setStatus(STOP); |
| 347 | } else { |
| 348 | setStatus(BRANCH); |
| 349 | stats.choices++; |
| 350 | } |
| 351 | stats.undetermined += kids; |
| 352 | for (int i=0; i<kids; i++) { |
| 353 | std::ostringstream oss; |
| 354 | s->print(*choice,i,oss); |
no test coverage detected