Example #1
0
void RangeImpl::setEndAfter(const DOM_Node& refNode)
{
    if( fDetached) {
        throw DOM_DOMException(
            DOM_DOMException::INVALID_STATE_ERR, null);
    }
    if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) {
        throw DOM_RangeException(
            DOM_RangeException::INVALID_NODE_TYPE_ERR, null);
    }

    fEndContainer = refNode.getParentNode();
    unsigned int i = 0;
    for (DOM_Node n = refNode; n!=null; n = n.getPreviousSibling(), i++) ;

    if (i ==0)
        fEndOffset = 0;
    else
        fEndOffset = i;

    if ((fDocument != refNode.getOwnerDocument() )
            && (refNode.getOwnerDocument().fImpl != 0) )
    {
        fDocument = refNode.getOwnerDocument();
        collapse(true);
    }

    //compare the start and end boundary point
    //collapse if start point is after the end point
    if(compareBoundaryPoints(DOM_Range::END_TO_START, this) == 1)
        collapse(false); //collapse the range positions to end
    else
        fCollapsed = false;
}
Example #2
0
void MarkerWidget::contextMenuEvent( QContextMenuEvent *e )
{
    QPopupMenu m( 0, "editor_breakpointsmenu" );

    int toggleBreakPoint = 0;
//    int editBreakpoints = 0;

    QTextParagraph *p = ( (Editor*)viewManager->currentView() )->document()->firstParagraph();
    int yOffset = ( (Editor*)viewManager->currentView() )->contentsY();
    bool supports = ( (Editor*)viewManager->currentView() )->supportsBreakPoints();
    while ( p && supports ) {
	if ( e->y() >= p->rect().y() - yOffset && e->y() <= p->rect().y() + p->rect().height() - yOffset ) {
	    if ( ( (ParagData*)p->extraData() )->marker == ParagData::Breakpoint )
		toggleBreakPoint = m.insertItem( tr( "Clear Breakpoint\tF9" ) );
	    else
		toggleBreakPoint = m.insertItem( tr( "Set Breakpoint\tF9" ) );
// 	    editBreakpoints = m.insertItem( tr( "Edit Breakpoints..." ) );
	    m.insertSeparator();
	    break;
	}
	p = p->next();
    }

    const int collapseAll = m.insertItem( tr( "Collapse All" ) );
    const int expandAll = m.insertItem( tr( "Expand All" ) );
    const int collapseFunctions = m.insertItem( tr( "Collapse all Functions" ) );
    const int expandFunctions = m.insertItem( tr( "Expand all Functions" ) );

    int res = m.exec( e->globalPos() );
    if ( res == -1)
	return;

    if ( res == collapseAll ) {
	emit collapse( TRUE );
    } else if ( res == collapseFunctions ) {
	emit collapse( FALSE );
    } else if ( res == expandAll ) {
	emit expand( TRUE );
    } else if ( res == expandFunctions ) {
	emit expand( FALSE );
    } else if ( res == toggleBreakPoint ) {
	if ( ( (ParagData*)p->extraData() )->marker == ParagData::Breakpoint ) {
	    ( (ParagData*)p->extraData() )->marker = ParagData::NoMarker;
	} else {
	    bool ok;
	    isBreakpointPossible( ok, ( (Editor*)viewManager->currentView() )->text(), p->paragId() );
	    if ( ok )
		( (ParagData*)p->extraData() )->marker = ParagData::Breakpoint;
	    else
		emit showMessage( tr( "<font color=red>Can't set breakpoint here!</font>" ) );
	}
//    } else if ( res == editBreakpoints ) {
//	emit editBreakPoints();
    }
    doRepaint();
    emit markersChanged();
}
Example #3
0
void start_random_number(
  int seed_a,
  int seed_b
){
/*
 * This procedure initialises the state table u for a lagged 
 * Fibonacci sequence generator, filling it with random bits 
 * from a small multiplicative congruential sequence.
 * The auxilliaries c, ni, and nj are also initialized.
 * The seeds are transformed into an initial state in such a way that
 * identical results are guaranteed across a wide variety of machines.
 */

    double       s, bit;
    unsigned int ii, jj, kk, mm;
    unsigned int ll;
    unsigned int sd;
    unsigned int elt, bit_number;

    sd = collapse(seed_a, PM1 * PM1);
    ii = 1 + sd / PM1;
    jj = 1 + sd % PM1;
    sd = collapse(seed_b, PM1 * Q);
    kk = 1 + sd / PM1;
    ll = sd % Q;
    if (ii == 1   &&   jj == 1   &&   kk == 1)  ii = 2;

    ni  = STATE_SIZE - 1;
    nj  = STATE_SIZE / 3;
    c   = INIT_C;
    c  /= RANDOM_REALS;		/* compiler might mung the division itself */
    cd = INIT_CD;
    cd /= RANDOM_REALS;
    cm  = INIT_CM;
    cm /= RANDOM_REALS;

    for (elt = 0; elt < STATE_SIZE; elt += 1) {
	s   = 0.0;
	bit = 1.0 / RANDOM_REALS;
	for (bit_number = 0; bit_number < MANTISSA_SIZE; bit_number += 1) {
	    mm = (((ii * jj) % P) * kk) % P;
	    ii = jj;
	    jj = kk;
	    kk = mm;
	    ll = (53 * ll + 1) % Q;
	    if (((ll * mm) % 64) >= 32) s += bit;
	    bit += bit;
	}
	u[elt] = s;
    }
}
Example #4
0
void goto_normal_form ( void )
{
  TRACEIN;

  bool finished = false;
  int x, y, val;
  while (wait_curr > waitinglist) {
    assert (wait_curr >= waitinglist+2);
    y = *(--wait_curr);		/* pop y first, see pushing */
    x = *(--wait_curr);
    val = cboard[x*ydim+y];
#ifdef TRACE
    if ((terminal_mode != false) && (anim_level >= 2))
      printf ("We popped B[%d,%d]=%d\n", x, y, val);
#endif /* TRACE */
    if (val > 3) {
      collapse(x,y);
    } else if (terminal_mode) {
      printf ("! False positive in waitinglist: x=%d y=%d val=%d\n",
	      x, y, cboard[x*ydim+y]);
    }
  }
#ifndef NDEBUG
  // FIXME: REMOVE LATER
  // CHECK FOR SAFETY:
  int count = 0;
  do {
    finished = true; /* tentatively */
    for (x = xmin; x <= xmax; x++) {
      for (y = xmin; y <= ymax; y++) {
	if (cboard[x*ydim+y] > 3) {
	  finished = false;
	  count++;
	  fprintf (stdout, "! Safety check has to collapse (%d,%d) val=%d\n", x, y, cboard[x*ydim+y]);
	  collapse(x,y);
	}
      }
    }
  } while (finished == false);
  if (count > 0) {
    fprintf (stdout, "ERROR: %s: Safety check had to collapse %d times\n", __func__, count);
    fprintf (stderr, "ERROR: %s: Safety check had to collapse %d times\n", __func__, count);
    fail();
  }
#endif /* NDEBUG */

  handle_terminated_board ();

  TRACEOUT;
}
	void processChar( char item, MyStack<Token> &stack, string &operations, bool &OK )
	{
		// Note:
		// I could check top of stack before adding tokens
		// and catch many errors "now" instead of later.
		// I'd rather be lazy and let collapse() catch the errors.

		Token token = toToken(item);
		switch (token)
		{
		case TOKEN_VALUE:
			if		( stack.isEmpty() ) { stack << token; return; }
			switch ( stack.top() )
			{
			case TOKEN_LEFT_GROUP:		stack << token; break;
			case TOKEN_ADDITION:		stack << token; break; // don't collapse yet
			case TOKEN_MULTIPLICATION:	collapse( stack << token, operations, OK ); break;
			default:					OK = false; break;
			}
			break;

		case TOKEN_ADDITION:
			collapse( stack, operations, OK);
			stack << TOKEN_ADDITION;
			break;

		case TOKEN_MULTIPLICATION:
		case TOKEN_LEFT_GROUP:
			stack << token;
			break;

		case TOKEN_RIGHT_GROUP:
			// clear any pending addidion
			collapse( stack, operations, OK );
			if ( !OK ) return;

			// convert ( value ) to value
			if ( !stack.isEmpty() && TOKEN_VALUE == stack.pop()
					&& !stack.isEmpty() && TOKEN_LEFT_GROUP == stack.pop() )
				stack << TOKEN_VALUE;
			else
				OK = false;
			break;

		case TOKEN_UNKNOWN:
			OK = false;
			break;
		}
	}
Example #6
0
FLUIQ::CollapsibleWidget::CollapsibleWidget( Qt::Orientation _or,
							Widget * _parent ) :
	Widget( _parent ),
	m_orientation( _or ),
	m_origMinSize(),
	m_origMaxSize(),
	m_masterLayout( NULL )
{
	if( m_orientation == Qt::Horizontal )
	{
		m_masterLayout = new QHBoxLayout( this );
	}
	else
	{
		m_masterLayout = new QVBoxLayout( this );
	}
	m_masterLayout->setMargin( 0 );
	m_masterLayout->setSpacing( 0 );
	setSizePolicy( QSizePolicy::Expanding,
					QSizePolicy::Expanding );
	m_header = new CollapsibleWidgetHeader( this );

	m_masterLayout->addWidget( m_header );
	m_masterLayout->insertStretch( 100, 0 );

	connect( m_header, SIGNAL( expanded() ),
			this, SLOT( expand() ) );
	connect( m_header, SIGNAL( collapsed() ),
			this, SLOT( collapse() ) );
}
Example #7
0
	void on_toggle()
	{
		if(is_collapsed())
			expand();
		else
			collapse();
	}
Example #8
0
    bool Move(int di)
    {
        //std::cerr <<p_[0]<<p_[1]<< "\n";
        auto tmp = p_;
        if (di == 0) {
            tmp[0]++;
        } else if (di < 0) {
            tmp[1]--;
        } else {
            tmp[1]++;
        }

        if (is_collision(vmat_, tmp, smat_)) {
            if (di == 0) {
                or_assign(vmat_, p_, smat_);
                auto sv = get_shape(vmat_);
                auto sa = get_shape(smat_);
                collapse(std::min(p_[0]+sa[0], sv[0]-1), std::max(0, p_[0]));
            }
            return false;
        }
        // std::cerr << V2d(tmp) <<" not collis\n";

        p_ = tmp; //std::cerr << V2d(p_) << "\n";
        if (di == 0) {
            td_ = time(0);
        }
        return true;
    }
Example #9
0
int Game::tick()
{
  if(stopped_) {
    return -1;
  }

  removePiece(piece_, px_, py_);
  int ny = py_ - 1;

  if(!doesPieceFit(piece_, px_, ny)) {
    // Must finish off with this piece
    placePiece(piece_, px_, py_);
    if(py_ >= board_height_) {
      // you lose.
      stopped_ = true;
      return -1;
    } else {
      int rm = collapse();
      generateNewPiece();
      return rm;
    }
  } else {
    placePiece(piece_, px_, ny);
    py_ = ny;
    return 0;
  }
}
Example #10
0
/*
 * ms_links - server message handler
 *
 * parv[0] = sender prefix
 * parv[1] = servername mask
 *
 * or
 *
 * parv[0] = sender prefix
 * parv[1] = server to query
 * parv[2] = servername mask
 */
int
ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   char *mask;
   struct Client *acptr;

   if (parc > 2)
   {
     if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
         HUNTED_ISME)
       return 0;
     mask = parv[2];
   }
   else
     mask = parc < 2 ? 0 : parv[1];
 
   for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr))
   {
     if (!IsServer(acptr) && !IsMe(acptr))
       continue;
     if (!BadPtr(mask) && match(mask, cli_name(acptr)))
       continue;
     send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up),
                cli_hopcount(acptr), cli_serv(acptr)->prot,
                ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)"));
   }
 
   send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
   return 0;
 }
Example #11
0
static void collapse(ivType *liv, object lo, int deep, object save_pointer) 
{ 
	object self = liv->iPrevious; 
	ivType *iv = ivPtr(self); 

	if (liv->iType == 2) { 
		if (deep || liv->iType == 1) 
			gDeepDispose(lo); 
		else 
			gDispose(lo); 
		if (!iv->iPrevious) 
			if (iv->iUsed == 1) { 
			gSetTopNode(iv->iBTree, iv->iObjects[iv->iObjects[0] == lo]); 
			iv->iObjects[0] = iv->iObjects[1] = NULL; 
			gDeepDispose(self); 
		} else 
			delete_intermediate_pointer(iv, lo); 
		else 
			if (iv->iUsed == 1) { 
			object save = iv->iObjects[0] == lo ? iv->iObjects[1] : iv->iObjects[0]; 
			iv->iObjects[0] = iv->iObjects[1] = NULL; 
			collapse(iv, self, deep, save); 
		} else 
			delete_intermediate_pointer(iv, lo); 
	} else { 
		int idx; 

		for (idx=0 ; iv->iObjects[idx] != lo ; idx++); 
		iv->iObjects[idx] = save_pointer; 
		gDeepDispose(lo); 
	} 
} 
Example #12
0
/**
 * Visits the nodes selected by this range when we know
 * a-priori that the start and end containers are not the
 * same, but the end container is an ancestor of the start container
 *
 */
DOM_DocumentFragment RangeImpl::traverseCommonEndContainer( DOM_Node startAncestor, int how )
{
    DOM_DocumentFragment frag = null;
    if ( how!=DELETE_CONTENTS)
        frag = fDocument.createDocumentFragment();
    DOM_Node n = traverseLeftBoundary( startAncestor, how );
    if ( frag!=null )
        frag.appendChild( n );
    int startIdx = indexOf( startAncestor, fEndContainer );
    ++startIdx;  // Because we already traversed it....

    int cnt = fEndOffset - startIdx;
    n = startAncestor.getNextSibling();
    while( cnt > 0 )
    {
        DOM_Node sibling = n.getNextSibling();
        DOM_Node xferNode = traverseFullySelected( n, how );
        if ( frag!=null )
            frag.appendChild( xferNode );
        --cnt;
        n = sibling;
    }

    if ( how != CLONE_CONTENTS )
    {
        setStartAfter( startAncestor );
        collapse( true );
    }

    return frag;
}
Example #13
0
bool fl_FrameLayout::doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc)
{
	UT_ASSERT(pcrxc->getType()==PX_ChangeRecord::PXT_ChangeStrux);
	fp_FrameContainer * pFrameC = static_cast<fp_FrameContainer *>(getFirstContainer());
	UT_GenericVector<fl_ContainerLayout *> AllLayouts;
	AllLayouts.clear();
	fp_Page * pPage = NULL;
	UT_sint32 i = 0;
	if(pFrameC)
	{
	    pPage = pFrameC->getPage();
	    UT_return_val_if_fail(pPage, false);
	    pPage->getAllLayouts(AllLayouts);
	    for(i=0; i< AllLayouts.getItemCount();i++)
	    {
	         fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
		 pCL->collapse();
	    }
	}
	setAttrPropIndex(pcrxc->getIndexAP());
	collapse();
	lookupProperties();
	format();
	for(i=0; i< AllLayouts.getItemCount();i++)
	{
	    fl_ContainerLayout * pCL = AllLayouts.getNthItem(i);
	    pCL->format();
	    xxx_UT_DEBUGMSG(("Format block %x \n",pBL));
	    pCL->markAllRunsDirty();
	}
	getDocSectionLayout()->markAllRunsDirty();
	return true;
}
Example #14
0
/*
 * rmap_alloc()
 *	Allocate some space from a resource map
 *
 * Returns 0 on failure.  Thus, you can't store index 0 in a resource map
 */
uint
rmap_alloc(struct rmap *rmap, uint size)
{
	struct rmap *r, *rlim;
	uint idx;

	ASSERT_DEBUG(size > 0, "rmap_alloc: zero size");
	/*
	 * Find first slot with a fit, return failure if we run
	 * off the end of the list without finding a fit.
	 */
	rlim = &rmap[rmap->r_off];
	for (r = &rmap[1]; r <= rlim; ++r) {
		if (r->r_size >= size)
			break;
	}
	if (r > rlim) {
		return(0);
	}

	/*
	 * Trim the resource element if it still has some left,
	 * otherwise delete from the list.
	 */
	idx = r->r_off;
	if (r->r_size > size) {
		r->r_off += size;
		r->r_size -= size;
	} else {
		collapse(rmap, r);
	}
	return(idx);
}
Example #15
0
void TreeView::CollapseWithParents(const QModelIndex &ind)
{
    if(ind.isValid()){
        collapse(ind);
        CollapseWithParents(ind.parent());
    }
}
Example #16
0
void SdDurationCanvas::merge(Q3PtrList<SdDurationCanvas> & l) {
  l.removeRef(this);
  
  QRect r = rect();
  int vmin = r.top();
  int vmax = r.bottom();
  SdDurationCanvas * d;
  
  for (d = l.first(); d != 0; d = l.next()) {
    QRect dr = d->rect();
    
    if (dr.top() < vmin)
      vmin = dr.top();
    if (dr.bottom() > vmax)
      vmax = dr.bottom();
    
    collapse(d);
  }
  
  if (vmin < r.top())
    Q3CanvasItem::moveBy(0, vmin - r.top());

  resize(r.width(), vmax - vmin + 1);
  update_self();
}
Example #17
0
File: WPanel.C Project: NovaWova/wt
void WPanel::undoExpand()
{
  if (wasCollapsed_)
    collapse();

  expandedSS_.emit(false);
}
Example #18
0
/*
 * flask_response_handler - Handles sending response to client and does
 * necessary clean up.
 *
 * @param i client socket identifier
 * @return  1 when successful. Simply exits when fatal error occurs.
 */
int flask_response_handler(int i)
{
    int errnoSave;
    int ret;
    tcp_connection *curr_connection = &((engine.connections)[i]);

    ret = send(i, curr_connection->response, curr_connection->response_index, MSG_NOSIGNAL);

    if (ret < 1)
    {
        errnoSave = errno;

        if (errnoSave != EPIPE && errnoSave != ECONNRESET)
        {
            close(i);
            close(engine.udp_sock);
            close(engine.tcp_sock);
            collapse(&gol);
            exit(EXIT_FAILURE);
        }
    }

    init_connection(curr_connection);
    FD_CLR(i, &(engine.rfds));
    FD_CLR(i, &(engine.wfds));
    close(i);

    return 1;
}
Example #19
0
void Machine::step()
{
	// fetch the next instruction
	debugList();
	int opcode = IP->getOpcode();
	switch(opcode) {
		case OPCODE_STARTLIST:
		case OPCODE_EVALUATED:
		case OPCODE_NOOP:
			IP++;
			break;
		case OPCODE_ENDLIST:
			collapse();
			break;
		case OPCODE_PAIR:
			expandPair();
			break;
		case OPCODE_PROCEDURE:
			applySkipVector();
			break;
		case OPCODE_SYMBOL:
			replaceSymbol();
			break;
		case OPCODE_ATOM:
			lexCurrent();
			break;
	}
}
Example #20
0
File: WPanel.C Project: NovaWova/wt
void WPanel::setCollapsed(bool on)
{
  if (on)
    collapse();
  else
    expand();
}
Example #21
0
/** The /who command: retrieves information from users. */
DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
aChannel *target_channel;
char *mask = parv[1];
char star[] = "*";
int i = 0;

	who_flags = 0;
	memset(&wfl, 0, sizeof(wfl));

	if (parc > 1)
	{
		i = parse_who_options(sptr, parc - 1, parv + 1);
		if (i < 0)
		{
			sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
			return 0;
		}
	}

	if (parc-i < 2 || strcmp(parv[1 + i], "0") == 0)
		mask = star;
	else
		mask = parv[1 + i];

	if (!i && parc > 2 && *parv[2] == 'o')
		who_flags |= WF_OPERONLY;

	collapse(mask);

	if (*mask == '\0')
	{
		/* no mask given */
		sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], "*");
		return 0;
	}

	if ((target_channel = find_channel(mask, NULL)) != NULL)
	{
		do_channel_who(sptr, target_channel, mask);
		sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
		return 0;
	}

	if (wfl.channel && wfl.want_channel == WHO_WANT && 
	    (target_channel = find_channel(wfl.channel, NULL)) != NULL)
	{
		do_channel_who(sptr, target_channel, mask);
		sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
		return 0;
	}
	else
	{
		do_other_who(sptr, mask);
		sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
		return 0;
	}

	return 0;
}
Example #22
0
bool WTreeNode::triggerSlot(WObject *sender, const WSlot_ *slot, void **args)
{
    if (slot == slots_ + 0) {
        sender_ = sender;
        collapse();
        return true;
    }
    if (slot == slots_ + 1) {
        sender_ = sender;
        expand();
        return true;
    }
    if (slot == slots_ + 2) {
        sender_ = sender;
        select();
        return true;
    }
    if (slot == slots_ + 3) {
        sender_ = sender;
        OnTreeNodeCheck();
        return true;
    }
    if (slot == slots_ + 4) {
        sender_ = sender;
        OnRightClick();
        return true;
    }
    return WCompositeWidget::triggerSlot(sender, slot, args);
}
Example #23
0
bool fl_EmbedLayout::doclistener_deleteStrux(const PX_ChangeRecord_Strux * pcrx)
{
	UT_ASSERT(pcrx->getType()==PX_ChangeRecord::PXT_DeleteStrux);
//
// Remove all remaining structures
//
	if(getPrev())
	{
	  getPrev()->setNeedsReformat(getPrev());
	}
	collapse();
//	UT_ASSERT(pcrx->getStruxType()== PTX_SectionFootnote);
//
// Find the block that contains this layout.
//
	PT_DocPosition prevPos = pcrx->getPosition();
	fl_BlockLayout * pEncBlock =  m_pLayout->findBlockAtPosition(prevPos);
//
// Fix the offsets for the block
//
	m_bHasEndFootnote = false;
	pEncBlock->updateOffsets(prevPos,0,-getOldSize());
	getSectionLayout()->remove(this);	
	delete this;			// TODO whoa!  this construct is VERY dangerous.

	return true;
}
Example #24
0
void NoisyCnaEnumerate::solve(const StlIntVector& pi,
                              int limit,
                              int timeLimit,
                              int threads,
                              int state_tree_limit,
                              bool monoclonal,
                              const IntSet& whiteList)
{
  RealTensor F, F_lb, F_ub;
  StateTreeVector S;
  StlIntVector mapNewCharToOldChar;
  StlIntVector mapOldCharToNewChar;
  
  _comp.init(pi[0], F, S, F_lb, F_ub, mapNewCharToOldChar, mapOldCharToNewChar);
  
  RootedCladisticNoisyAncestryGraph G(F, S, F_lb, F_ub);
  G.init();
  
  collapse(mapNewCharToOldChar, mapOldCharToNewChar, G);
  if (monoclonal)
  {
    fixTrunk(F_ub, S, mapNewCharToOldChar, mapOldCharToNewChar, G);
  }
    
  G.setLabels(F);
//  G.RootedCladisticAncestryGraph::writeDOT(std::cerr);
  
  IntSet remappedWhiteList;
  for (const int c : whiteList)
  {
    int cc = mapOldCharToNewChar[c];
    if (cc != -1)
    {
      remappedWhiteList.insert(cc);
    }
  }
  
  RootedCladisticNoisyEnumeration enumerate(G,
                                            limit,
                                            timeLimit,
                                            threads,
                                            _treeSize,
                                            true,
                                            monoclonal,
                                            remappedWhiteList);
  enumerate.run();
  
  if (enumerate.objectiveValue() >= _treeSize)
  {
    if (enumerate.objectiveValue() > _treeSize)
    {
      _sols.clear();
      _treeSize = enumerate.objectiveValue();
    }
    enumerate.populateSolutionSet(_sols);
  }
  
  std::cerr << std::endl << "Tree size: " << enumerate.objectiveValue() << "/" << _treeSize << std::endl;
}
Example #25
0
void QFoldingContainer::setExpanded(bool expanded)
{
  expanded_ = expanded;
  if ( !expanded_ )
    collapse();
  else
    expand();
}
Example #26
0
void OutlineElement::toggleExpand()
//---------------------------------
{
    if( _state == ESExpanded ) {
        collapse();
    } else {
        expand();
    }
}
Example #27
0
bool fl_EmbedLayout::doclistener_changeStrux(const PX_ChangeRecord_StruxChange * pcrxc)
{
	UT_ASSERT(pcrxc->getType()==PX_ChangeRecord::PXT_ChangeStrux);


	setAttrPropIndex(pcrxc->getIndexAP());
	collapse();
	return true;
}
Example #28
0
/*
 * ms_whois - server message handler
 *
 * parv[0] = sender prefix
 * parv[1] = nickname masklist
 *
 * or
 *
 * parv[1] = target server, or a nickname representing a server to target.
 * parv[2] = nickname masklist
 */
int ms_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
  char*           nick;
  char*           tmp;
  char*           p = 0;
  int             found = 0;
  int		  total = 0;

  if (parc < 2)
  {
    send_reply(sptr, ERR_NONICKNAMEGIVEN);
    return 0;
  }

  if (parc > 2)
  {
    if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) !=
        HUNTED_ISME)
      return 0;
    parv[1] = parv[2];
  }

  total = 0;
  
  for (tmp = parv[1]; (nick = ircd_strtok(&p, tmp, ",")); tmp = 0)
  {
    struct Client *acptr = 0;

    found = 0;
    
    collapse(nick);
    

    acptr = FindUser(nick);
    if (acptr && !IsServer(acptr)) {
      found++;
      do_whois(sptr, acptr, parc);
    }

    if (!found)
      send_reply(sptr, ERR_NOSUCHNICK, nick);
      
    total+=found;
      
    if (total >= MAX_WHOIS_LINES) {
      send_reply(sptr, ERR_QUERYTOOLONG, parv[1]);
      break;
    }
      
    if (p)
      p[-1] = ',';
  } /* of tokenised parm[1] */
  send_reply(sptr, RPL_ENDOFWHOIS, parv[1]);

  return 0;
}
Example #29
0
void Board::turn(Direction dir)
{
    Board original = *this;
    move(dir);
    collapse(dir);
    move(dir);

    if(original != *this)
        add();
}
void QmlJSOutlineTreeView::collapseAllExceptRoot()
{
    if (!model())
        return;
    const QModelIndex rootElementIndex = model()->index(0, 0, rootIndex());
    int rowCount = model()->rowCount(rootElementIndex);
    for (int i = 0; i < rowCount; ++i) {
        collapse(model()->index(i, 0, rootElementIndex));
    }
}