Ejemplo n.º 1
0
bool IcicleTreeCanvas::compressInit(VisualNode& root, int idx, int absX) {
  const int kids = root.getNumberOfChildren();
  auto& na = node_tree.getNA();
  bool hasSolved = false;
  int leafCnt = 0, expectSolvedCnt = 0, actualSolvedCnt = 0;
  statistic[idx].ns = root.getStatus();
  statistic[idx].absX = absX;
  for (int i = 0; i < kids; i++) {
    int kidIdx = root.getChild(i);
    VisualNode& kid = *na[kidIdx];
    if (kid.hasSolvedChildren()) expectSolvedCnt++;
    if (statistic[kidIdx].height >= compressLevel) {
      bool kidRes = compressInit(kid, kidIdx, absX + leafCnt);
      hasSolved |= kidRes;
      leafCnt += statistic[kidIdx].leafCnt;
      if (kidRes) actualSolvedCnt++;
    }
  }
  statistic[idx].leafCnt = leafCnt? leafCnt: 1;
  if (kids && statistic[idx].height == compressLevel)
    statistic[idx].ns = root.hasSolvedChildren()? SOLVED: FAILED;
  else if (expectSolvedCnt > actualSolvedCnt)
    statistic[idx].ns = SOLVED;
  return hasSolved | (statistic[idx].ns == SOLVED);
}
Ejemplo n.º 2
0
 forceinline bool
 HideFailedCursor::mayMoveDownwards(void) {
   VisualNode* n = node();
   return (!onlyDirty || n->isDirty()) &&
          NodeCursor<VisualNode>::mayMoveDownwards() &&
          (n->hasSolvedChildren() || n->getNoOfOpenChildren(na) > 0) &&
          (! n->isHidden());
 }
Ejemplo n.º 3
0
 forceinline void
 HideFailedCursor::processCurrentNode(void) {
   VisualNode* n = node();
   if (n->getStatus() == BRANCH &&
       !n->hasSolvedChildren() &&
       n->getNoOfOpenChildren(na) == 0) {
     n->setHidden(true);
     n->setChildrenLayoutDone(false);
     n->dirtyUp(na);
   }
 }