void TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired()
{
    std::function<void()> updateFunction;
    {
        LockHolder locker(m_lock);
        if (!m_compositorThreadUpdateFunction)
            return;
        updateFunction = WTFMove(m_compositorThreadUpdateFunction);
    }

    updateFunction();
}
QString TPrototypeAjaxHelper::linkToUpdate(const QString &text, const QUrl &url, const QString &id, UpdateBehavior behavior, const TOption &options, bool evalScripts, const QString &jsCondition, const THtmlAttribute &attributes) const
{
    QString string;
    string += QLatin1String("<a href=\"#\" onclick=\"");
    string += updateFunction(url, id, behavior, options, evalScripts, jsCondition);
    string += QLatin1String(" return false;\"");
    string += attributes.toString();
    string += QLatin1Char('>');
    string += text;
    string += QLatin1String("</a>");
    return string;
}
LRESULT ListFilter::onSelChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& bHandled) {
    if (hWndCtl == column.m_hWnd || hWndCtl == method.m_hWnd) {
        if (hWndCtl == column.m_hWnd)
            columnChanged(true);
        if (hWndCtl == method.m_hWnd)
            usingTypedMethod = false;

        updateFunction();
    }
    bHandled = FALSE;
    return 0;
}
Exemple #4
0
void updateBehaviorPool(Game* game, BehaviorPool* pool)
{
	void (*updateFunction)(Game* game, Behavior*) = pool->update;
	
	if(updateFunction != null)
	{
		int count = 0;
		for(int i = 0; i < BEHAVIOR_POOL_SIZE; i += pool->behaviorSize)
		{
			if(count++ > pool->itemCount)
				break;
			Behavior* behavior = (Behavior*)(&pool->data[i]);
			if(behavior->active)
				updateFunction(game, behavior);
		}
	}
}
void ListFilter::textUpdated(bool alwaysUpdate) {
    auto filter = getText();

    mode = LAST;
    auto start = string::npos;
    if (!filter.empty()) {
        if (filter.compare(0, 2, ">=") == 0) {
            mode = GREATER_EQUAL;
            start = 2;
        } else if (filter.compare(0, 2, "<=") == 0) {
            mode = LESS_EQUAL;
            start = 2;
        } else if (filter.compare(0, 2, "==") == 0) {
            mode = EQUAL;
            start = 2;
        } else if (filter.compare(0, 2, "!=") == 0) {
            mode = NOT_EQUAL;
            start = 2;
        } else if (filter[0] == _T('<')) {
            mode = LESS;
            start = 1;
        } else if (filter[0] == _T('>')) {
            mode = GREATER;
            start = 1;
        } else if (filter[0] == _T('=')) {
            mode = EQUAL;
            start = 1;
        }
    }

    if (start != string::npos) {
        method.SetCurSel(StringMatch::METHOD_LAST + mode);
        filter = filter.substr(start, filter.length()-start);
        usingTypedMethod = true;
    } else if (usingTypedMethod) {
        method.SetCurSel(0);
    }

    if (alwaysUpdate || filter != matcher.pattern) {
        matcher.pattern = filter;
        updateFunction();
    }
}
void ALCBaselineModellingPresenter::initialize() {
  m_view->initialize();

  // View actions
  connect(m_view, SIGNAL(fitRequested()), SLOT(fit()));
  connect(m_view, SIGNAL(addSectionRequested()), SLOT(addSection()));
  connect(m_view, SIGNAL(removeSectionRequested(int)),
          SLOT(removeSection(int)));

  // View events (sync)
  connect(m_view, SIGNAL(sectionRowModified(int)),
          SLOT(onSectionRowModified(int)));
  connect(m_view, SIGNAL(sectionSelectorModified(int)),
          SLOT(onSectionSelectorModified(int)));

  // Model updates
  connect(m_model, SIGNAL(dataChanged()), SLOT(updateDataCurve()));
  connect(m_model, SIGNAL(correctedDataChanged()),
          SLOT(updateCorrectedCurve()));
  connect(m_model, SIGNAL(fittedFunctionChanged()), SLOT(updateFunction()));
  connect(m_model, SIGNAL(fittedFunctionChanged()),
          SLOT(updateBaselineCurve()));
}
Exemple #7
0
double * sa( 
    size_t * I,              /* initial state                                 */
    double * Q,              /* initial costs                                 */
    size_t * J,              /* final state                                   */
    double * R,              /* final costs                                   */
    double * D,              /* distance matrix                               */
    double * costChange,     /* the cost change                               */
    void * A,                /* administrative data                           */
    size_t dN,               /* number of distance matricies                  */
    size_t N,                /* number of elements within a state             */
    size_t m,                /* max number of iterations                      */
    size_t auxFunctionIter,  /* how often to run the auxiliar update function */
    size_t costChangeSize,
    initFunctionPtr initSAFunction,  /* initialize function                   */
    randomStateFunctionPtr randomStateSAFunction,
    costChangeFunctionPtr costChangeFunction,
                             /* cost change function                          */
    updateFunctionPtr updateFunction,/* update function                       */
    coolFunctionPtr coolFunction,    /* cooling schedule                      */ 
    diagFunctionPtr diagFunction     /* diagnostic function                   */ 
    )  {

  size_t newI = 0;           /* potential index                               */
  size_t i;                  /* iteration index                               */
  double newCostChange=0;    /* change in total cost                          */
  double T;                  /* value of cooling schedule                     */
  double U;                  /* U(0,1) random variable                        */

/* take care of R random number generator */
  GetRNGstate();
  i = 0;

/* initialize the algorithm */
//Rprintf("\n****************** init ****************\n");
  initSAFunction( I, Q, D, A, dN, N);
 
  while( i < m ) {
//Rprintf("\n****************** start = %d ****************\n", (int) i );
//diagFunction(i,I,Q,A,dN,N);


    // print status every 1000th 
    if( m > 1 ) { 
      if( m < 10000 ) {
        Rprintf("Percent Complete: %4.2f\r", (float) (100*i)/m);
      } else if( (1000 * i) % 65535 == 0 ) {
        Rprintf("Percent Complete: %4.2f\r", (float) (100*i)/m);
        //R_checkUserInterrupt();
      }
    }
    
    
// 1. select a potential move t_{i+1} 
    newI = randomStateSAFunction( I, Q, J, R, D, A, dN, N);

    // if there are no possible movements we terminate 
    if( newI > N ) {
      return( costChange ); 
    }

    costChange[i * costChangeSize + 1] = -1;
    costChange[i * costChangeSize + 2] = 0;        // accept 
    costChange[i * costChangeSize + 3] = newI + 1; // move from 
  
    newCostChange = costChangeFunction( newI, I, Q, J, R, D, A, dN, N);
//diagFunction(i,I,Q,A,dN,N);
//printf("costChangeFunction - %f\n", newCostChange);  
    costChange[i * costChangeSize] = newCostChange;

    // 2. if the move improves the objective function then s_{i+1} = t_{i+1} 
    if( newCostChange <= 0 ) {

      costChange[i * costChangeSize + 2] = 1;
      updateFunction(1, newI, I, Q, J, R, D, A, dN, N, NULL);   

    } else {

      T = coolFunction( i, newCostChange, newI, I, Q, D, A, dN, N);   
      U = runif(0.0,1.0); 
      
      costChange[i * costChangeSize + 1] = U;
      costChange[i * costChangeSize + 2] = T;
      
      // 3. else if the Pr( U < T( i ) ), for a random variate U then s_{i+1} = t_{i+1} 
      if( U < T ) {

        updateFunction(1, newI, I, Q, J, R, D, A, dN, N, NULL);   

      } 
// 4. else s_{i+1} = s_{i} 
// accept state 0:
// copy back to the candidate states the original values
      updateFunction(0, newI, I, Q, J, R, D, A, dN, N, NULL );   

    }
      
// update cost change 
// accept state 2:
// change back candidate states and copy back  
    updateFunction(2, newI, I, Q, J, R, D, A, dN, N, &(costChange[i * costChangeSize ]) );   

// 6. ommitted, it is implemented as the while loop 
// 6. else goto 1 
//

    i++; 
  } 
 
  PutRNGstate();
  
// output status   
  Rprintf("Percent Complete: %4.2f\n", (float) (i*100)/m  );


  return( costChange );
}
Exemple #8
0
	void ViewFile::onStateChanged() noexcept {
		updateFunction(tth);
	}