Пример #1
0
bool HMM3SearchWorker::isReady() const {
    if (isDone()) {
        return false;
    }
    bool seqEnded = seqPort->isEnded();
    bool hmmEnded = hmmPort->isEnded();
    int seqHasMes = seqPort->hasMessage();
    int hmmHasMes = hmmPort->hasMessage();
    return hmmHasMes || (hmmEnded && (seqHasMes || seqEnded));
}
bool PWMatrixSearchWorker::isReady() const {
    if (isDone()) {
        return false;
    }
    bool dataEnded = dataPort->isEnded();
    bool modelEnded = modelPort->isEnded();
    int dataHasMes = dataPort->hasMessage();
    int modelHasMes = modelPort->hasMessage();
    return modelHasMes || (modelEnded && (dataHasMes || dataEnded));
}
Пример #3
0
void PeerSet::invokeOnTimer ()
{
    ScopedLockType sl (mLock, __FILE__, __LINE__);

    if (isDone ())
        return;

    if (!isProgress())
    {
        ++mTimeouts;
        WriteLog (lsWARNING, InboundLedger) << "Timeout(" << mTimeouts << ") pc=" << mPeers.size () << " acquiring " << mHash;
        onTimer (false, sl);
    }
    else
        onTimer (true, sl);

    if (!isDone ())
        setTimer ();
}
/*virtual*/ void BaseIterator::last()
{
	///////////////////////////////////////////////////
	first();
	///////////////////////////////////////////////////
	while(!isDone())
		next();
	prev();
	///////////////////////////////////////////////////
}
Пример #5
0
void SWActAnimate::onUpdate()
{
	m_spendTime += SWTime.getDeltaTime() * m_speed;
	if ( isDone() ) return;

	tuint index = (tuint)(m_spendTime / m_sequence()->getDelayPerUnit());
	if ( index == m_lastIndex ) return;

	changeSpriteWithAt( index );
	m_lastIndex = index;
}
Пример #6
0
bool
LogoMove::update () throw ()
{
	if ( m_is_active && isDone() )
	{
		_turnMotorsOff();
		m_is_active = false;
	}

	return ! m_is_active;
}
Пример #7
0
bool InboundLedger::checkLocal ()
{
    ScopedLockType sl (mLock);

    if (!isDone () && tryLocal())
    {
        done();
        return true;
    }
    return false;
}
/*virtual*/ void BaseOddIterator::first()
{
	///////////////////////////////////////////////////
	 _currentIndex=0;
	while(!isDone())
		if(currentItem()->getN()%2!=0)
			break;
		else
			++_currentIndex;
	///////////////////////////////////////////////////
}
Пример #9
0
void
AsyncCommStage::Member::pushToCompletionQueue()
{
   if (!isDone()) {
      TBOX_ERROR("AsyncCommStage::Member::pushToCompletionQueue error:\n"
         << "This method may not be called by Members that have not\n"
         << "completed their operation (and returns true from isDone()."
         << std::endl);
   }
   d_stage->privatePushToCompletionQueue(*this);
}
Пример #10
0
boolean EDefaultWriteFuture::isWritten() {
	if (isDone()) {
		EObject* v = getValue();

		EBoolean* b = dynamic_cast<EBoolean*>(v);
		if (b) {
			return b->booleanValue();
		}
	}

	return false;
}
Пример #11
0
void HTMLImportChild::createCustomElementMicrotaskStepIfNeeded()
{
    ASSERT(!m_customElementMicrotaskStep);

    if (!isDone() && !formsCycle()) {
#if ENABLE(OILPAN)
        m_customElementMicrotaskStep = CustomElement::didCreateImport(this);
#else
        m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->weakPtr();
#endif
    }
}
Пример #12
0
void JabberHttpPool::write(const char *buf, unsigned size)
{
    writeData.pack(buf, size);
    if (!isDone())
        return;
    Buffer *packet = new Buffer;
    *packet << m_cookie.c_str() << ";" << getKey().c_str() << ",";
    packet->pack(writeData.data(), writeData.writePos());
    char headers[] = "Content-Type: application/x-www-form-urlencoded";
    fetch(m_url.c_str(), headers, packet);
    writeData.init(0);
}
Пример #13
0
EThrowable* EDefaultWriteFuture::getException() {
	if (isDone()) {
		EObject* v = getValue();

		EThrowableObject<EThrowable>* t = dynamic_cast<EThrowableObject<EThrowable>*>(v);
		if (t) {
			return t->getThrowable();
		}
	}

	return null;
}
Пример #14
0
void PeerSet::invokeOnTimer ()
{
    boost::recursive_mutex::scoped_lock sl (mLock);

    if (isDone ())
        return;

    if (!mProgress)
    {
        ++mTimeouts;
        WriteLog (lsWARNING, InboundLedger) << "Timeout(" << mTimeouts << ") pc=" << mPeers.size () << " acquiring " << mHash;
        onTimer (false);
    }
    else
    {
        mProgress = false;
        onTimer (true);
    }

    if (!isDone ())
        setTimer ();
}
Пример #15
0
bool corpsExploreData::Done()
{
    if (isDone())
    {
        state = 0;
        refresh();
        return true;
    }
    else
    {
        return false;
    }
}
Пример #16
0
 void Action::finish()
 {
     fzUInt iterations = 0;
     
     do
     {
         step(FLT_MAX);
         ++iterations;
         if(iterations > 200) {
             FZ_ASSERT(false, "Too many iterations, infinite actions cannot be finished.");
             break;
         }
     } while(!isDone());
 }
Пример #17
0
void PeerSet::invokeOnTimer ()
{
    ScopedLockType sl (mLock);

    if (isDone ())
        return;

    if (!isProgress())
    {
        ++mTimeouts;
        JLOG (m_journal.debug) << "Timeout(" << mTimeouts
            << ") pc=" << mPeers.size () << " acquiring " << mHash;
        onTimer (false, sl);
    }
    else
    {
        mProgress = false;
        onTimer (true, sl);
    }

    if (!isDone ())
        setTimer ();
}
Пример #18
0
FtpThread::FtpThread(short ThreadIndex, long startByte, long size, QUrl url, QFile *file)
{
    this->ThreadIndex=ThreadIndex;
    this->startByte=startByte;
    this->size=size;
    this->url=url;
    this->file=file;
    this->doneBytes=0;
    ftp = new QFtp(this);
    connect(ftp,SIGNAL(readyRead()),this,SLOT(writeData()));
    timer =new QTimer(this);
    connect( timer, SIGNAL(timeout()),this,SLOT(isDone()) );
    timer->start(1000);
}
Пример #19
0
/**
 * @param image_out the RGB image
 * @param depth_out the depth image
 * @param mask_out the mask image
 * @param rect_out the bounding box of the rendered image
 */
void
RendererIterator::render(cv::Mat &image_out, cv::Mat &depth_out, cv::Mat &mask_out, cv::Rect &rect_out)
{
  if (isDone())
    return;

  cv::Vec3d t, up;
  view_params(t, up);

  renderer_->lookAt(t(0), t(1), t(2), up(0), up(1), up(2));
  //renderer_->render(image_out, depth_out, mask_out, rect_out);
  renderer_->renderDepthOnly(depth_out, mask_out, rect_out);
  renderer_->renderImageOnly(image_out, rect_out);
}
Пример #20
0
void TDHCPServer::run()
{	
    bool silent = false;
    while ( (!isDone()) && (!SrvTransMgr().isDone()) ) {
    	if (serviceShutdown)
	    SrvTransMgr().shutdown();
	
	SrvTransMgr().doDuties();
	unsigned int timeout = SrvTransMgr().getTimeout();
	if (timeout == 0)        timeout = 1;
	if (serviceShutdown)     timeout = 0;
	
	if (!silent)
	    Log(Notice) << "Accepting connections. Next event in " << timeout 
			<< " second(s)." << LogEnd;
#ifdef WIN32
	// There's no easy way to break select under Windows, so just don't sleep for too long.
	if (timeout>5) {
	    silent = true;
	    timeout = 5;
	}
#endif
	
	SPtr<TSrvMsg> msg=SrvIfaceMgr().select(timeout);
	if (!msg) 
	    continue;
	silent = false;
	int iface = msg->getIface();
	SPtr<TIfaceIface> ptrIface;
	ptrIface = SrvIfaceMgr().getIfaceByID(iface);
	Log(Notice) << "Received " << msg->getName() << " on " << ptrIface->getName() 
		    << "/" << iface << hex << ",TransID=0x" << msg->getTransID() 
		    << dec << ", " << msg->countOption() << " opts:";
	SPtr<TOpt> ptrOpt;
	msg->firstOption();
	while (ptrOpt = msg->getOption() )
	    Log(Cont) << " " << ptrOpt->getOptType();
	Log(Cont) << ", " << msg->getRelayCount() << " relay(s)." << LogEnd;
	if (SrvCfgMgr().stateless() && ( (msg->getType()!=INFORMATION_REQUEST_MSG) &&
					 (msg->getType()!=RELAY_FORW_MSG))) {
	    Log(Warning) 
		<< "Stateful configuration related message received while running in the stateless mode. Message ignored." 
		<< LogEnd;
	    continue;
	} 
	SrvTransMgr().relayMsg(msg);
    }
    Log(Notice) << "Bye bye." << LogEnd;
}
Пример #21
0
void HTMLImportChild::ensureLoader()
{
    if (m_loader)
        return;

    if (HTMLImportChild* found = toHTMLImportsController(root())->findLinkFor(m_url, this))
        shareLoader(found);
    else
        createLoader();

    if (!isDone() && !formsCycle()) {
        ASSERT(!m_customElementMicrotaskStep);
        m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->weakPtr();
    }
}
/*virtual*/ void BaseOddIterator::next()
{
	///////////////////////////////////////////////////
	while(true)
	{
		///////////////////////////////////////////
		++_currentIndex;
		if(isDone())
			break;
		if(currentItem()->getN()%2!=0)
			break;
		///////////////////////////////////////////
	}
	///////////////////////////////////////////////////
}
Пример #23
0
void WeatherCfg::search()
{
    if (!isDone()){
        stop();
        btnSearch->setText(i18n("&Search"));
        textChanged(cmbLocation->lineEdit()->text());
        return;
    }
    if (cmbLocation->lineEdit()->text().isEmpty())
        return;
    btnSearch->setText(i18n("&Cancel"));
    string url = "http://xoap.weather.com/search/search?where=";
    url += toTranslit(cmbLocation->lineEdit()->text()).utf8();
    fetch(url.c_str());
}
Пример #24
0
void MazeWindow::showDijkstra() {
  auto tmp = std::make_shared<UniDijkstra>(std::max(0, mazeWidget->getClicked()));
  auto colorizer = std::make_shared<DijkstraColorizer>(tmp);

  tmp->setGrid(maker->grid());

  auto start = Clock::now();
  while( !tmp->isDone()) tmp->step();
  auto dur = Clock::now() - start;
  std::cout << "It took " << std::chrono::duration_cast< std::chrono::milliseconds >(dur).count() << "ms" << std::endl;

  mazeWidget->setMaker(tmp);
  mazeWidget->setColorizer(colorizer);
  mazeWidget->repaint();
}
Пример #25
0
	bool ProgressBar::doesTriggerDone()
	{
		if (isDone())
		{
			if (doneTriggered)
			{
				return false;
			} else {
				doneTriggered = true;
				return true;
			}
		} else {
			return false;
		}
	}
Пример #26
0
void dijkstra(Dict_t * Q, Agraph_t * G, Agnode_t * n)
{
    Agnode_t *u;
    Agedge_t *e;

    pre(G);
    setdist(n, 1);
    dtinsert(Q, n);
    while ((u = extract_min(Q))) {
	setDone (u);
	for (e = agfstedge(G, u); e; e = agnxtedge(G, e, u)) {
	    if (!isDone(e->node)) update(Q, e->node, u, getlength(e));
	}
    }
    post(G);
}
Пример #27
0
bool Action::step( float dt )
{
    bool updated = !isDone();
    if (m_firstTick){
        m_elapsed = 0;
        onStart();
        m_firstTick = false;
    }
    m_elapsed += dt;
    if (m_easing){
        update(m_easing->update(min(1, m_elapsed/m_duration)));
    }else{
        update(min(1, m_elapsed/m_duration));
    }
    return updated;
}
void rice::Continuation_MultiContinuation::receive(int32_t index, ::java::lang::Object* o)
{
    if((!done) && (!(*haveResult)[index])) {
        (*haveResult)[index] = true;
        result->set(index, o);
        try {
            if(isDone()) {
                done = true;
                npc(parent)->receiveResult(getResult());
            }
        } catch (::java::lang::Exception* e) {
            done = true;
            npc(parent)->receiveException(e);
        }
    }
}
Пример #29
0
void UpdatePlugin::timeout()
{
    if (!getSocketFactory()->isActive() || !isDone() || m_msg)
        return;
    time_t now;
    time(&now);
    if ((unsigned)now >= getTime() + CHECK_INTERVAL){
        string url = "http://sim.shutoff.ru/cgi-bin/update1.pl?v=" VERSION;
#ifdef WIN32
        url += "&os=1";
#else
#ifdef QT_MACOSX_VERSION
        url += "&os=2";
#endif
#endif
#ifdef CVS_BUILD
        url += "&cvs=";
        for (const char *p = __DATE__; *p; p++){
            if (*p == ' '){
                url += "%20";
                continue;
            }
            url += *p;
        }
#else
        url += "&release";
#endif
        url += "&l=";
        QString s = i18n("Message", "%n messages", 1);
        s = s.replace(QRegExp("1 "), "");
        for (int i = 0; i < (int)(s.length()); i++){
            unsigned short c = s[i].unicode();
            if ((c == ' ') || (c == '%') || (c == '=') || (c == '&')){
                char b[5];
                sprintf(b, "%02X", c);
                url += b;
            }else if (c > 0x77){
                char b[10];
                sprintf(b, "#%04X", c);
                url += b;
            }else{
                url += (char)c;
            }
        }
        fetch(url.c_str(), NULL, NULL, false);
    }
}
Пример #30
0
void GameState::execute(const Action &action)
{
    if (action.type == ActionType::NONE) return;

    auto &att = getUnit(action.attacker);
    auto &def = getUnit(action.defender);

    if (action.path.size() > 1) {
        assert(att.isAlive());
        moveUnit(action.attacker, action.path.back());
    }

    if (action.type == ActionType::ATTACK ||
        action.type == ActionType::RANGED ||
        action.type == ActionType::RETALIATE)
    {
        assert(att.isAlive());
        assert(def.isAlive());
        auto numKilled = assignDamage(action.defender, action.damage);

        if (att.hasTrait(Trait::LIFE_DRAIN)) {
            att.hpLeft = std::min(att.hpLeft + action.damage, att.type->hp);
        }
        if (att.hasTrait(Trait::ZOMBIFY)) {
            att.num += numKilled;
        }
    }
    else if (action.type == ActionType::EFFECT) {
        assert(def.isAlive());
        assert(action.manaCost == 0 || action.manaCost <= manaLeft_[att.team]);

        auto effect = action.effect;
        if (!effect.isDone()) {
            // Effects with duration stay with the defending unit.
            def.effect = effect;
        }

        assignDamage(action.defender, action.damage);
        manaLeft_[att.team] -= action.manaCost;
    }

    if (action.type == ActionType::RETALIATE &&
        !att.hasTrait(Trait::STEADFAST))
    {
        att.retaliated = true;
    }
}