/// This also updates next bound inline double changeInCost(int iRow, double alpha, double &rhs) { int sequence=model_->pivotVariable()[iRow]; double returnValue = 0.0; unsigned char iStatus = status_[sequence]; int iWhere = currentStatus(iStatus); if (iWhere == CLP_SAME) iWhere = originalStatus(iStatus); // rhs always increases if (iWhere == CLP_FEASIBLE) { if (alpha > 0.0) { // going below iWhere = CLP_BELOW_LOWER; rhs = COIN_DBL_MAX; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs = COIN_DBL_MAX; } } else if (iWhere == CLP_BELOW_LOWER) { assert (alpha < 0); // going feasible iWhere = CLP_FEASIBLE; rhs += bound_[sequence] - model_->upperRegion()[sequence]; } else { assert (iWhere == CLP_ABOVE_UPPER); // going feasible iWhere = CLP_FEASIBLE; rhs += model_->lowerRegion()[sequence] - bound_[sequence]; } setCurrentStatus(status_[sequence], iWhere); returnValue = fabs(alpha) * infeasibilityWeight_; return returnValue; }
void IntroAnimation::step(double dt) { setCurrentStatus(animation->step(dt)); if (animation->isEnded() && listener_ != 0) { std::cout << "animation ended!\n"; listener_->ended(0); } }
/// This also updates next bound inline double changeInCost(int sequence, double alpha, double &rhs) { double returnValue = 0.0; #ifdef NONLIN_DEBUG double saveRhs = rhs; #endif if (CLP_METHOD1) { int iRange = whichRange_[sequence] + offset_[sequence]; if (alpha > 0.0) { assert(iRange - 1 >= start_[sequence]); offset_[sequence]--; rhs += lower_[iRange] - lower_[iRange-1]; returnValue = alpha * (cost_[iRange] - cost_[iRange-1]); } else { assert(iRange + 1 < start_[sequence+1] - 1); offset_[sequence]++; rhs += lower_[iRange+2] - lower_[iRange+1]; returnValue = alpha * (cost_[iRange] - cost_[iRange+1]); } } if (CLP_METHOD2) { #ifdef NONLIN_DEBUG double saveRhs1 = rhs; rhs = saveRhs; #endif unsigned char iStatus = status_[sequence]; int iWhere = currentStatus(iStatus); if (iWhere == CLP_SAME) iWhere = originalStatus(iStatus); // rhs always increases if (iWhere == CLP_FEASIBLE) { if (alpha > 0.0) { // going below iWhere = CLP_BELOW_LOWER; rhs = COIN_DBL_MAX; } else { // going above iWhere = CLP_ABOVE_UPPER; rhs = COIN_DBL_MAX; } } else if (iWhere == CLP_BELOW_LOWER) { assert (alpha < 0); // going feasible iWhere = CLP_FEASIBLE; rhs += bound_[sequence] - model_->upperRegion()[sequence]; } else { assert (iWhere == CLP_ABOVE_UPPER); // going feasible iWhere = CLP_FEASIBLE; rhs += model_->lowerRegion()[sequence] - bound_[sequence]; } setCurrentStatus(status_[sequence], iWhere); #ifdef NONLIN_DEBUG assert(saveRhs1 == rhs); #endif returnValue = fabs(alpha) * infeasibilityWeight_; } return returnValue; }
void FsRadProgressDlg::OnStop() { if (!supressAreYouSure() && AfxMessageBox(L"Are you sure you wish to stop processing?", MB_YESNO) != IDYES) return; stopRequested() = true; stopButton.EnableWindow(FALSE); pauseButton.EnableWindow(FALSE); setCurrentStatus(L"Stopping..."); RedrawWindow(); }
BOOL FsRadProgressDlg::OnInitDialog() { CDialog::OnInitDialog(); currentTaskProgress.SetRange(0, 1000); setCurrentStatus(L""); setCurrentPercent(0.0f); ShowWindow(SW_SHOW); HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(hIcon, TRUE); SetIcon(hIcon, FALSE); return TRUE; }
void JabberRoomChat::participantChanged(const QString &id) { auto jid = Jid::parse(id); auto contact = m_contactManager->byId(m_chat.chatAccount(), id, ActionCreateAndAdd); auto buddy = m_buddyManager->byContact(contact, ActionCreateAndAdd); buddy.setDisplay(jid.resource()); buddy.setTemporary(true); auto status = m_presenceService->presenceToStatus(m_room->participantPresence(id)); contact.setCurrentStatus(status); auto details = static_cast<ChatDetailsRoom *>(m_chat.details()); if (status.isDisconnected()) details->removeContact(contact); else details->addContact(contact); }
void GaduProtocol::socketContactStatusChanged( UinType uin, unsigned int ggStatusId, const QString &description, unsigned int maxImageSize) { auto newStatus = Status{}; newStatus.setType(GaduProtocolHelper::statusTypeFromGaduStatus(ggStatusId)); newStatus.setDescription(description); if (uin == GaduLoginParams.uin) { if ((!m_lastRemoteStatusRequest.isValid() || m_lastRemoteStatusRequest.elapsed() > 10) && newStatus != m_lastSentStatus) { emit remoteStatusChangeRequest(account(), newStatus); if (m_lastRemoteStatusRequest.isValid()) m_lastRemoteStatusRequest.restart(); else m_lastRemoteStatusRequest.start(); } return; } auto contact = contactManager()->byId(account(), QString::number(uin), ActionReturnNull); contact.setMaximumImageSize(maxImageSize); auto oldStatus = contact.currentStatus(); contact.setCurrentStatus(newStatus); contact.setBlocking(GaduProtocolHelper::isBlockingStatus(ggStatusId)); if (contact.isAnonymous()) { if (contact.ownerBuddy()) emit userStatusChangeIgnored(contact.ownerBuddy()); rosterService()->removeContact(contact); return; } // see issue #2159 - we need a way to ignore first status of given contact if (contact.ignoreNextStatusChange()) contact.setIgnoreNextStatusChange(false); else emit contactStatusChanged(contact, oldStatus); }