void CUserAdminItem::doubleClicked() { #ifdef DEBUG qDebug("CUserAdminItem::doubleClicked()"); #endif if (isBlocked()) return; if (!is_connected && !isBlocked()) setConnected(true); }
void CButton::clickLeft(tribool down, bool previousState) { if(isBlocked()) return; if (down) { if (!soundDisabled) CCS->soundh->playSound(soundBase::button); setState(PRESSED); } else if(hoverable && hovered) setState(HIGHLIGHTED); else setState(NORMAL); if (actOnDown && down) { onButtonClicked(); } else if (!actOnDown && previousState && (down==false)) { onButtonClicked(); } }
void CDatabaseItem::refreshWidget(bool b) { #ifdef DEBUG qDebug("CDatabaseItem::refreshWidget(%s)", debug_string(booltostr(b))); #endif if (isBlocked()) return; setBlocked(true); if (widget_id == int_type()) { CShowDatabaseGroupProperties * w = (CShowDatabaseGroupProperties *) widgetStack()->widget(int_type()); w->setMySQL(mysql()); w->setTitle(mysql()->connectionName()); if (b || widgetData.isEmpty()) { w->refresh(); w->saveData(&widgetData); } else w->loadData(widgetData); } else ((CDatabaseListViewItem *) QListViewItem::parent())->refreshWidget(b); widgetStack()->raiseWidget(widget_id); setBlocked(false); }
bool LidSpaceCompactionJob::scanDocuments(const LidUsageStats &stats) { if (_scanItr->valid()) { DocumentMetaData document = getNextDocument(stats); if (document.valid()) { IFrozenBucketHandler::ExclusiveBucketGuard::UP bucketGuard = _frozenHandler.acquireExclusiveBucket(document.bucketId); if ( ! bucketGuard ) { // the job is blocked until the bucket for this document is thawed setBlocked(BlockedReason::FROZEN_BUCKET); _retryFrozenDocument = true; return true; } else { MoveOperation::UP op = _handler.createMoveOperation(document, stats.getLowestFreeLid()); search::IDestructorCallback::SP context = _moveOpsLimiter->beginOperation(); _opStorer.storeOperation(*op, context); _handler.handleMove(*op, std::move(context)); if (isBlocked(BlockedReason::OUTSTANDING_OPS)) { return true; } } } } if (!_scanItr->valid()){ if (shouldRestartScanDocuments(_handler.getLidStatus())) { _scanItr = _handler.getIterator(); } else { _scanItr = IDocumentScanIterator::UP(); _shouldCompactLidSpace = true; } } return false; // more work to do (scan documents or compact lid space) }
void CToggleButton::clickLeft(tribool down, bool previousState) { // force refresh hover(false); hover(true); if(isBlocked()) return; if (down && canActivate()) { CCS->soundh->playSound(soundBase::button); setState(PRESSED); } if(previousState)//mouse up { if(down == false && getState() == PRESSED && canActivate()) { onButtonClicked(); setSelected(!selected); } else doSelect(selected); // restore } }
void CDatabaseItem::setConnected(bool isconnected) { #ifdef DEBUG qDebug("CDatabaseItem::setConnected(%s)", debug_string(booltostr(isconnected))); #endif if (isBlocked()) return; setBlocked(true); if (isconnected) is_connected = isconnected && mysql()->mysql()->mysqlSelectDb(text(0)); else is_connected = false; setPixmap(0, is_connected ? databaseConnectedIcon : databaseDisconnectedIcon); if (is_connected) { new CTableGroupItem(this, text(0), mysql()); setOpen(true); } else deleteChilds(); createWindowMenu(consoleWindow()->itemToolBar()); setBlocked(false); }
glm::vec3 BidirectionalIntegrator::EvaluatePath(std::vector<PathNode> &eyePath, int nEye, std::vector<PathNode> &lightPath, int nLight) { if (isBlocked(eyePath[nEye-1].isx, lightPath[nLight-1].isx)) { return glm::vec3(0.f); } glm::vec3 L(1.0f); // eyePath for (int i = 0; i < nEye-1; ++i) { L *= eyePath[i].F * glm::abs(glm::dot(eyePath[i].dirOut_world, eyePath[i].isx.normal)) / (eyePath[i].pdf); } // connecting L *= eyePath[nEye-1].F * G(eyePath[nEye-1], lightPath[nLight-1]) * lightPath[nLight-1].F; // lightPath for (int i = nLight-2; i >= 0; --i) { L *= lightPath[i].F * glm::abs(glm::dot(lightPath[i].dirOut_world, lightPath[i].isx.normal)) / (lightPath[i].pdf); } return L; }
size_t TensorType::getSize() const { size_t size = (isBlocked()) ? blockType->getSize() : 1; for (int dimension : dimensions) { size *= dimension; } return size; }
void InteractableObject::setMomentToUndo(){ if (isBlocked()) momentToUndo = time(NULL) + timeToUndo + timeToUnblock; else momentToUndo = time(NULL) + timeToUndo; }
void CQueryTable::refresh() { if (isBlocked()) return; reset(); m_cancel = false; if (!query()->isResultNull()) { setBlocked(true); query()->dataSeek(0); uint num_fields = query()->numFields(); ulong num_rows = query()->numRows(); setNumRows(num_rows); setNumCols(num_fields); QPixmap icon; bool columns_ok = (keepColumnWidth() && previous_columns_map.count() == num_fields); if (columns_ok) for (uint i = 0; i < num_fields; i++) columns_ok &= (previous_columns_map[i].label == query()->fields(i).name); if (!columns_ok && keepColumnWidth()) previous_columns_map.clear(); for (uint i = 0; i < num_fields; i++) { if (IS_PRI_KEY(query()->fields(i).flags)) icon = pkIcon; else if (IS_MUL_KEY(query()->fields(i).flags)) icon = mulIcon; else if (IS_UNI_KEY(query()->fields(i).flags)) icon = uniIcon; else icon = nothingIcon; if (columns_ok && previous_columns_map[i].label == query()->fields(i).name) horizontalHeader()->setLabel(i, icon, query()->fields(i).name, previous_columns_map[i].size); else horizontalHeader()->setLabel(i, icon, query()->fields(i).name); } if (hasProcessEvents()) qApp->processEvents(); else updateScrollBars(); ulong j = 0; while (query()->next(!hasProcessEvents())) { if (m_cancel) break; for (uint i = 0; i < num_fields; i++) setText(j, i, query()->row(i)); j++; } setBlocked(false); emit refreshed(); } else if (!previous_columns_map.empty()) previous_columns_map.clear(); }
uint AccountRecord::secsToUnblock() const { if ( isBlocked() ) return ~0; else if ( blockUntil.isValid() && blockUntil < QDateTime::currentDateTime() ) return QDateTime::currentDateTime().secsTo( blockUntil ); return 0; }
V3MPDRCube* const V3VrfMPDR::recursiveBlockCube(V3MPDRCube* const badCube) { // Create a Queue for Blocking Cubes V3BucketList<V3MPDRCube*> badQueue(getPDRFrame()); assert (badCube); badQueue.add(getPDRDepth(), badCube); // Block Cubes from the Queue V3MPDRTimedCube baseCube, generalizedCube; while (badQueue.pop(baseCube.first, baseCube.second)) { assert (baseCube.first < getPDRFrame()); if (!baseCube.first) { // Clear All Cubes in badQueue before Return V3Set<const V3MPDRCube*>::Set traceCubes; traceCubes.clear(); const V3MPDRCube* traceCube = baseCube.second; while (true) { traceCubes.insert(traceCube); if (_pdrBad == traceCube) break; traceCube = traceCube->getNextCube(); } while (badQueue.pop(generalizedCube.first, generalizedCube.second)) { if (traceCubes.end() == traceCubes.find(generalizedCube.second)) delete generalizedCube.second; } return baseCube.second; // A Cube cannot be blocked by R0 --> Cex } if (!isBlocked(baseCube)) { assert (!existInitial(baseCube.second->getState())); // Check Reachability : SAT (R ^ ~cube ^ T ^ cube') if (checkReachability(baseCube.first, baseCube.second->getState())) { // SAT, Not Blocked Yet if (profileON()) _ternaryStat->start(); generalizedCube.second = extractModel(baseCube.second, baseCube.first - 1); if (profileON()) _ternaryStat->end(); badQueue.add(baseCube.first - 1, generalizedCube.second); // This Cube should be blocked in previous frame badQueue.add(baseCube.first, baseCube.second); // This Cube has not yet been blocked (postpone to future) } else { // UNSAT, Blocked bool satGen = true; while (true) { if (profileON()) _generalStat->start(); generalizedCube.first = baseCube.first; generalizedCube.second = new V3MPDRCube(*(baseCube.second)); generalization(generalizedCube); // Generalization if (profileON()) _generalStat->end(); addBlockedCube(generalizedCube); // Record this Cube that is bad and to be blocked // I found Niklas Een has modified the original IWLS paper and alter the line below // However, I suggest the alteration restricts PDR (i.e. fold-free) and does not help if (satGen && (baseCube.first < getPDRDepth()) && (generalizedCube.first < getPDRFrame())) badQueue.add(baseCube.first + 1, baseCube.second); //if ((baseCube.first < getPDRDepth()) && (generalizedCube.first < getPDRDepth())) // badQueue.add(generalizedCube.first + 1, baseCube.second); if (!isForwardSATGen() || getPDRDepth() <= generalizedCube.first) break; baseCube.second = forwardModel(generalizedCube.second); if (!baseCube.second) break; baseCube.first = baseCube.first + 1; satGen = false; if (checkReachability(baseCube.first, baseCube.second->getState())) break; } } } //else delete baseCube.second; } return 0; }
/** * Moves back a blocked thread to a priority queue. * Has no effect on unblocked threads. */ void PriorityQueue::resume(int id) { int location = isBlocked(id); if (location != -1) { enqueueElement(_Blocked.at(location)); _Blocked.erase(_Blocked.begin() + location); } }
void PrivacyManager::slotDenyRemoved() { PrivacyItemTask * pit = ( PrivacyItemTask * )sender(); if ( pit->success() ) { m_denyList.remove( pit->dn() ); emit privacyChanged( pit->dn(), isBlocked( pit->dn() ) ); } }
void PrivacyManager::slotAllowAdded() { PrivacyItemTask * pit = ( PrivacyItemTask * )sender(); if ( pit->success() ) { m_allowList.append( pit->dn() ); emit privacyChanged( pit->dn(), isBlocked( pit->dn() ) ); } }
void CDatabaseItem::doubleClicked() { #ifdef DEBUG qDebug("CDatabaseItem::doubleClicked()"); #endif if (!is_connected && !isBlocked()) setConnected(true); }
void CUserAdminItem::activated() { #ifdef DEBUG qDebug("CUserAdminItem::activated()"); #endif if (isBlocked()) return; refreshWidget(false); }
void CDatabaseItem::activated() { #ifdef DEBUG qDebug("CDatabaseItem::activated()"); #endif if (isBlocked()) return; refreshWidget(false); }
void restart(tcb_t *target) { if (isBlocked(target)) { ipcCancel(target); setupReplyMaster(target); setThreadState(target, ThreadState_Restart); tcbSchedEnqueue(target); switchIfRequiredTo(target); } }
TEST_F(MoveTest, Execute_TargetIsBlocked) { ON_CALL(mWorld, isBlocked(glm::ivec2(1, 0))) .WillByDefault(Return(true)); auto move = std::make_shared<Move>(mJobStack, mWorld, mOwner, glm::ivec2(1, 0)); mJobStack.push_back(move); move->execute(1000); EXPECT_EQ(glm::ivec2(0, 0), mOwnerPosition.get<glm::ivec2>()); }
void CButton::hover (bool on) { if(hoverable && !isBlocked()) { if(on) setState(HIGHLIGHTED); else setState(NORMAL); } /*if(pressedL && on) // WTF is this? When this is used? setState(PRESSED);*/ std::string name = hoverTexts[getState()].empty() ? hoverTexts[getState()] : hoverTexts[0]; if(!name.empty() && !isBlocked()) //if there is no name, there is nohing to display also { if (LOCPLINT && LOCPLINT->battleInt) //for battle buttons { if(on && LOCPLINT->battleInt->console->alterTxt == "") { LOCPLINT->battleInt->console->alterTxt = name; LOCPLINT->battleInt->console->whoSetAlter = 1; } else if (LOCPLINT->battleInt->console->alterTxt == name) { LOCPLINT->battleInt->console->alterTxt = ""; LOCPLINT->battleInt->console->whoSetAlter = 0; } } else if(GH.statusbar) //for other buttons { if (on) GH.statusbar->setText(name); else if ( GH.statusbar->getText()==(name) ) GH.statusbar->clear(); } } }
bool Piece::canMove(string dest) { int move[2] = {0,0}; move[0] = static_cast<int>(dest[0]-m_position[0]); move[1] = static_cast<int>(dest[1]-m_position[1]); if (isDestPossible(dest, move)) { if (!isBlocked(dest, move)) return true; } return false; }
void CAdministrationWindow::refresh() { if (isBlocked()) return; setBlocked(true); processList->refresh(); status->refresh(); if (has_innodb) innoDBStatus->refresh(); messagePanel()->information(tr("Refresh successful")); setBlocked(false); }
void WindowBasedEdge::doUpdateBlocking() { if (!isReserved()) { return; } if (isBlocked()) { m_window.unmap(); m_approachWindow.unmap(); } else { m_window.map(); m_approachWindow.map(); } }
int main(void){ openFiles(); int i, j; scanf("%d %d", &width, &height); for (j = 0; j < height; j++) for (i = 0; i < width; i++) scanf("%d", &map[i][j]); for (j = 0; j < height; j++){ for (i = 0; i < width; i++){ if (!room[i][j]){ room[i][j] = TOPROCESS; flood_fill(); } } } for (i = 0; i < width; i++){ for (j = height - 1; j >= 0; j--){ if (isBlocked(north, map[i][j])){ tryJoining(i,j,i,j-1,'N'); } if (isBlocked(east, map[i][j])){ tryJoining(i,j,i+1,j,'E'); } } } printf("%d\n", nextRoom-1); printf("%d\n", largestRoom); printf("%d\n", max); printf("%d %d %c\n", besty + 1, bestx + 1, bestDir); return 0; }
void Pathfinding::calculate(BattleUnit *unit, Position endPosition) { Position startPosition = unit->getPosition(); _movementType = unit->getArmor()->getMovementType(); _unit = unit; Tile *destinationTile = _save->getTile(endPosition); // check if destination is not blocked if (isBlocked(destinationTile, MapData::O_FLOOR) || isBlocked(destinationTile, MapData::O_OBJECT)) return; // the following check avoids that the unit walks behind the stairs if we click behind the stairs to make it go up the stairs. // it only works if the unit is on one of the 2 tiles on the stairs, or on the tile right in front of the stairs. if (isOnStairs(startPosition, endPosition)) { endPosition.z++; destinationTile = _save->getTile(endPosition); } // check if we have floor, else lower destination (for non flying units only, because otherwise they never reached this place) while (canFallDown(destinationTile) && _movementType != MT_FLY) { endPosition.z--; destinationTile = _save->getTile(endPosition); } _path.clear(); // look for a possible fast and accurate bresenham path and skip A* if (startPosition.z == endPosition.z && bresenhamPath(startPosition,endPosition)) { std::reverse(_path.begin(), _path.end()); //paths are stored in reverse order return; } // Now try through A*. aStarPath(startPosition, endPosition); }
void CProcessListTable::DoubleClicked(int row, int col, int button, const QPoint &) { if (isBlocked() || button != 1 || col < 1) return; QString txt = text(row, 7); if (txt.isEmpty() || txt.isNull()) return; CQueryWindow *w = new CQueryWindow(myApp()->workSpace(), mysql(), CQueryWindow::QUERY, SQL_PANEL | RESULTS_PANEL); w->setQuery(txt); w->setFocus(); w->raise(); myShowWindow(w); }
void CDatabaseItem::keyPressed(QKeyEvent * e) { #ifdef DEBUG qDebug("CDatabaseItem::keyPressed()"); #endif if (isBlocked()) return; if (e->key() == QListViewItem::Key_Delete) processMenu(MENU_DELETE); else CDatabaseListViewItem::keyPressed(e); }
Swift::Presence::ref Buddy::generatePresenceStanza(int features, bool only_new) { std::string alias = getAlias(); std::string name = getSafeName(); Swift::StatusShow s; std::string statusMessage; if (!getStatus(s, statusMessage)) return Swift::Presence::ref(); if (m_jid.getNode().empty()) { generateJID(); } Swift::Presence::ref presence = Swift::Presence::create(); presence->setFrom(m_jid); presence->setTo(m_rosterManager->getUser()->getJID().toBare()); presence->setType(Swift::Presence::Available); if (!statusMessage.empty()) presence->setStatus(statusMessage); if (s.getType() == Swift::StatusShow::None) presence->setType(Swift::Presence::Unavailable); presence->setShow(s.getType()); if (presence->getType() != Swift::Presence::Unavailable) { // caps presence->addPayload(boost::shared_ptr<Swift::Payload>(new Swift::CapsInfo(m_rosterManager->getUser()->getComponent()->getBuddyCapsInfo()))); // if (features & 0/*TRANSPORT_FEATURE_AVATARS*/) { presence->addPayload(boost::shared_ptr<Swift::Payload>(new Swift::VCardUpdate (getIconHash()))); // } if (isBlocked()) { presence->addPayload(boost::shared_ptr<Swift::Payload>(new Transport::BlockPayload ())); } } // if (only_new) { // if (m_lastPresence) // m_lastPresence->setTo(Swift::JID("")); // if (m_lastPresence == presence) { // return Swift::Presence::ref(); // } // m_lastPresence = presence; // } return presence; }
QString ActionsWidget::getBlockButtonText() const { auto user = peer()->asUser(); if (!user || (user->id == AuthSession::CurrentUserPeerId())) return QString(); if (user->blockStatus() == UserData::BlockStatus::Unknown) return QString(); if (user->isBlocked()) { if (user->botInfo) { return lang(lng_profile_unblock_bot); } return lang(lng_profile_unblock_user); } else if (user->botInfo) { return lang(lng_profile_block_bot); } return lang(lng_profile_block_user); }