Example #1
0
Status ComparisonMatchExpression::init( const StringData& path, const BSONElement& rhs ) {
    initPath( path );
    _rhs = rhs;

    if ( rhs.eoo() ) {
        return Status( ErrorCodes::BadValue, "need a real operand" );
    }

    if ( rhs.type() == Undefined ) {
        return Status( ErrorCodes::BadValue, "cannot compare to undefined" );
    }

    switch ( matchType() ) {
    case LT:
    case LTE:
    case EQ:
    case GT:
    case GTE:
        _allHaveToMatch = false;
        break;
    default:
        return Status( ErrorCodes::BadValue, "bad match type for ComparisonMatchExpression" );
    }

    return Status::OK();
}
Example #2
0
bool Walker::init(){
    // CCString* filePath = CCString::createWithFormat("%s_%d_%WALKER_S_WAVE_0.png", m_icon.c_str(), m_side, "N");
    CCString* filePath = CCString::createWithFormat("%s_%d_%s_move_0.png", m_icon.c_str(), m_side, m_direct != "SW" ? "N" : "SW"); // guo.jiang
    if(CCLoadSprite::getSF(filePath->getCString())==NULL){
        CCLOG("filePath=%s",filePath->getCString());
    }
    m_shadow = CCLoadSprite::createSprite("walker_shadow.png");
    m_shadow->setAnchorPoint(ccp(0.5, 0.5));
    m_shadow->setOpacity(127);
    m_batchNode->addChild(m_shadow);
    
    m_iconSpr = CCLoadSprite::createSprite(filePath->getCString());
    m_iconSpr->setAnchorPoint(ccp(0.5,0.5));
    m_batchNode->addChild(m_iconSpr);
    //begin a by ljf  //解决造出兵时的遮挡问题
    m_iconSpr->setCameraMask(m_batchNode->getCameraMask(), true);
    //end a by ljf
    changeDirect(m_direct);
    float scale = 0.5;
    if(m_isHead){
        scale = 2;
    }
    m_iconSpr->setScale(scale);
    
    initPath();
    
    
    startMove();
    
    return true;
}
Example #3
0
Knob::Knob() {
    this->x1 = 0;
    this->y1 = 0;
    this->x2 = 0;
    this->y2 = 0;
    initPath();
}
void PSCustomBuildPage::OnBrowseCustomBuildWD(wxCommandEvent& event)
{
    DirSaver ds;

    // Since all paths are relative to the project, set the working directory to the
    // current project path
    ProjectPtr p = ManagerST::Get()->GetProject(m_projectName);
    if(p) {
        wxSetWorkingDirectory(p->GetFileName().GetPath());
    }

    wxFileName fn(m_textCtrlCustomBuildWD->GetValue());
    wxString initPath(wxEmptyString);

    if(fn.DirExists()) {
        fn.MakeAbsolute();
        initPath = fn.GetFullPath();
    }

    wxString new_path =
        wxDirSelector(_("Select working directory:"), initPath, wxDD_DEFAULT_STYLE, wxDefaultPosition, this);
    if(new_path.IsEmpty() == false) {
        m_textCtrlCustomBuildWD->SetValue(new_path);
    }
}
Example #5
0
KIconLoader::KIconLoader( KConfig *conf, 
			  const QString &app_name, const QString &var_name ){

  QStrList list;

  config = conf;
  config->setGroup(app_name);
  config->readListEntry( var_name, list, ':' );

  for (const char *it=list.first(); it; it = list.next())
    addPath(it);

  initPath();

  name_list.setAutoDelete(TRUE);
  pixmap_dirs.setAutoDelete(TRUE);
  pixmap_list.setAutoDelete(TRUE);

  /*
  for(char* c = pixmap_dirs.first(); c ; c = pixmap_dirs.next()){
    printf("in path:%s\n",pixmap_dirs.current());
  }
  */

}
Example #6
0
Status BitTestMatchExpression::init(StringData path,
                                    const char* bitMaskBinary,
                                    uint32_t bitMaskLen) {
    for (uint32_t byte = 0; byte < bitMaskLen; byte++) {
        char byteAt = bitMaskBinary[byte];
        if (!byteAt) {
            continue;
        }

        // Build _bitMask with the first 8 bytes of the bitMaskBinary.
        if (byte < 8) {
            _bitMask |= static_cast<uint64_t>(byteAt) << byte * 8;
        } else {
            // Checking bits > 63 is just checking the sign bit, since we sign-extend numbers. For
            // example, the 100th bit of -1 is considered set if and only if the 63rd bit position
            // is set.
            _bitMask |= 1ULL << 63;
        }

        for (int bit = 0; bit < 8; bit++) {
            if (byteAt & (1 << bit)) {
                _bitPositions.push_back(8 * byte + bit);
            }
        }
    }

    return initPath(path);
}
Example #7
0
Knob::Knob(int x1, int y1, int x2, int y2) {
    this->x1 = x1;
    this->y1 = y1;
    this->x2 = x2;
    this->y2 = y2;
    initPath();
}
Example #8
0
Status ModMatchExpression::init(StringData path, int divisor, int remainder) {
    if (divisor == 0)
        return Status(ErrorCodes::BadValue, "divisor cannot be 0");
    _divisor = divisor;
    _remainder = remainder;
    return initPath(path);
}
Example #9
0
GreenSquare::GreenSquare() {
    speed = 100;
    initPath();
    score = 20;
    this->_boundindrect = path.boundingRect();
    this->_pen = QPen(QColor("green"));
    this->_pen.setWidth(1);
}
Example #10
0
GreenCrossSquare::GreenCrossSquare() {
    speed = 2;
    initPath();
    this->_boundindrect = path.boundingRect();
    score = 40;
    this->_pen = QPen(QColor("magenta"));
    _pen.setWidth(1);
}
Example #11
0
Status BitTestMatchExpression::init(StringData path, uint64_t bitMask) {
    for (int bit = 0; bit < 64; bit++) {
        if (bitMask & (1LL << bit)) {
            _bitPositions.push_back(bit);
        }
    }

    return initPath(path);
}
Example #12
0
Pacman::Pacman() {
    speed = 1;
    orientation = 270;
    initPath();
    this->_boundindrect = path.boundingRect();
    score = 42;
    this->_pen = QPen(QColor("Yellow"));
    this->_pen.setWidth(2);

}
Example #13
0
std::unique_ptr<MatchExpression> TextMatchExpression::shallowClone() const {
    auto expr = stdx::make_unique<TextMatchExpression>();
    // We initialize _ftsQuery here directly rather than calling init(), to avoid needing to examine
    // the index catalog.
    expr->_ftsQuery = _ftsQuery;
    invariantOK(expr->initPath("_fts"));
    if (getTag()) {
        expr->setTag(getTag()->clone());
    }
    return std::move(expr);
}
Example #14
0
Status TextMatchExpression::init(OperationContext* txn,
                                 const NamespaceString& nss,
                                 TextParams params) {
    _ftsQuery.setQuery(std::move(params.query));
    _ftsQuery.setLanguage(std::move(params.language));
    _ftsQuery.setCaseSensitive(params.caseSensitive);
    _ftsQuery.setDiacriticSensitive(params.diacriticSensitive);

    fts::TextIndexVersion version;
    {
        // Find text index.
        ScopedTransaction transaction(txn, MODE_IS);
        AutoGetDb autoDb(txn, nss.db(), MODE_IS);
        Lock::CollectionLock collLock(txn->lockState(), nss.ns(), MODE_IS);
        Database* db = autoDb.getDb();
        if (!db) {
            return {ErrorCodes::IndexNotFound,
                    str::stream() << "text index required for $text query (no such collection '"
                                  << nss.ns() << "')"};
        }
        Collection* collection = db->getCollection(nss);
        if (!collection) {
            return {ErrorCodes::IndexNotFound,
                    str::stream() << "text index required for $text query (no such collection '"
                                  << nss.ns() << "')"};
        }
        std::vector<IndexDescriptor*> idxMatches;
        collection->getIndexCatalog()->findIndexByType(txn, IndexNames::TEXT, idxMatches);
        if (idxMatches.empty()) {
            return {ErrorCodes::IndexNotFound, "text index required for $text query"};
        }
        if (idxMatches.size() > 1) {
            return {ErrorCodes::IndexNotFound, "more than one text index found for $text query"};
        }
        invariant(idxMatches.size() == 1);
        IndexDescriptor* index = idxMatches[0];
        const FTSAccessMethod* fam =
            static_cast<FTSAccessMethod*>(collection->getIndexCatalog()->getIndex(index));
        invariant(fam);

        // Extract version and default language from text index.
        version = fam->getSpec().getTextIndexVersion();
        if (_ftsQuery.getLanguage().empty()) {
            _ftsQuery.setLanguage(fam->getSpec().defaultLanguage().str());
        }
    }

    Status parseStatus = _ftsQuery.parse(version);
    if (!parseStatus.isOK()) {
        return parseStatus;
    }

    return initPath("_fts");
}
Example #15
0
Status RegexMatchExpression::init(StringData path, StringData regex, StringData options) {
    if (regex.size() > MaxPatternSize) {
        return Status(ErrorCodes::BadValue, "Regular expression is too long");
    }

    _regex = regex.toString();
    _flags = options.toString();
    _re.reset(new pcrecpp::RE(_regex.c_str(), flags2options(_flags.c_str())));

    return initPath(path);
}
Example #16
0
Status BitTestMatchExpression::init(StringData path, uint64_t bitMask) {
    _bitMask = bitMask;

    // Process bitmask into bit positions.
    for (int bit = 0; bit < 64; bit++) {
        if (_bitMask & (1ULL << bit)) {
            _bitPositions.push_back(bit);
        }
    }

    return initPath(path);
}
Example #17
0
int main(void)
{
    int select = 0;
    for(;;)
    {
        system("cls");
        initPath(); /* 初始化路径 */
        do {
            printf("-------------------------------------------------\n");
            printf("The Default Path is : %s\n", SELF_LOAD_DEFAULT_PATH);
            printf("Now The Path is     : %s\n", getBackUpPath());
            printf("-------------------------------------------------\n");
            printf("That is a System Back Up Software for Windows! \n");
            printf("List of the software function : \n");
            printf("1. Back Up \n");
            printf("2. Set Back Up Path \n");
            printf("3. Show Path History\n");
            printf("4. Read Me \n");
            printf("5. Exit \n");
            printf("-------------------------------------------------\n");

            printf("Your Select: ");
            scanf("%d", &select);
            getchar();
        } while(select != 1 && select != 2 &&
                select != 3 && select != 4 &&
                select != 5  );
        system("cls");

        switch(select)
        {
        case 1 :
            printf("Back Up Begin! \n");
            showBUSelect();    // 开始备份
            printf("Back Up End!   \n");
            break;
        case 2 :
            getEnterPath();     // 设置备份存储路径
            break;
        case 3 :
            showPathHistory(); // 查看以往的备份存储路径历史
            break;
        case 4 :
            showReadMe();
            break;
        case 5 :
            exit(1);
        default:
            break;
        }/** switch(select) **/
    }/** for(;;) **/
    return 0;
}
Example #18
0
Status BitTestMatchExpression::init(StringData path, std::vector<uint32_t> bitPositions) {
    _bitPositions = std::move(bitPositions);

    // Process bit positions into bitmask.
    for (auto bitPosition : _bitPositions) {
        // Checking bits > 63 is just checking the sign bit, since we sign-extend numbers. For
        // example, the 100th bit of -1 is considered set if and only if the 63rd bit position is
        // set.
        bitPosition = std::min(bitPosition, 63U);
        _bitMask |= 1ULL << bitPosition;
    }

    return initPath(path);
}
Example #19
0
/* CONSTRUCTORS */
MotionPath::MotionPath(unsigned int numPoints, float xMax, float yMax, float zMax, float distanceBetweenPoints)
{
    this->numPoints				= numPoints;
    this->xMax					= xMax;
    this->yMax					= yMax;
    this->zMax					= zMax;
    this->distanceBetweenPoints = distanceBetweenPoints;

    currentValue	= new Point3f();
    points			= new Point3f[numPoints];
    position		= 0.0f;

    initPath();
}
Example #20
0
Status BitTestMatchExpression::init(StringData path,
                                    const char* bitMaskBinary,
                                    uint32_t bitMaskLen) {
    for (uint32_t byte = 0; byte < bitMaskLen; byte++) {
        char byteAt = bitMaskBinary[byte];
        if (!byteAt) {
            continue;
        }

        for (int bit = 0; bit < 8; bit++) {
            if (byteAt & (1 << bit)) {
                _bitPositions.push_back(8 * byte + bit);
            }
        }
    }

    return initPath(path);
}
Example #21
0
static void
initState(String argv0)
{
	uclIsCompileOnly = false;
	uclIsLink   = false;
	uclOptimize = false;
	uclDebug    = false;
	uclProfile  = false;
	uclFortran  = false;
	uclStdc     = false;
	uclFileList = listNil(String);
	uclIncludePath = listNil(String);
	uclDefines = listNil(String);
	uclUnDefines = listNil(String);
	uclOptFile = NULL;
	
	cfgSetCondFunc(uclCheckCondition);
	initPath(argv0);
}
Example #22
0
int main(int argc, char *argv[])
{
    QSystemSemaphore sema("UniqueFishPro",1,QSystemSemaphore::Open);
    sema.acquire();
    QSharedMemory mem("SystemObject");
    if (!mem.create(1))
    {
        sema.release();
        QApplication::activeWindow();
        return 0;
    }
    sema.release();

    QApplication a(argc, argv);
    a.setOrganizationName("YanboOrg");
    a.setApplicationName("FishSoftware");

    initPath();

    QApplication::setStyle(QStyleFactory::create("Fusion"));

    Widget w;
    w.setWindowFlags(w.windowFlags()& ~Qt::WindowMaximizeButtonHint);
    //! [0]
    //Yanbo Tcp class Define and handle:TCP连接类处理方法
    ////1 槽
    //connect(/*你定义的TCP连接类对象*/,SIGNAL(/*对应的信号*/),&w,SLOT(finishedConnectSlot(int,bool)));//连接成功返回对应组号连接状态
    //connect(/*你定义的TCP连接类对象*/,SIGNAL(/*对应的信号*/),&w,SLOT(finishedPutWeigh(int,send_head)));//称量成功后返回实际称量对应槽处理函数
    ////1 信号处理
    ////    void sendConnectSocket(QMap<int,QString>);//点击“发送”按钮,触发信号,发送组号及对应IP
    ////    void sendGroupPutWeighInfo(int,send_head);//发送称量信息-以得到返回称量并进行UI交互
    ////    void sendGroupBatchInfo(int,send_head);//发送投料信息-以进行最后实际处理-TCP接收站信号后发送数据到硬件进行处理
    ////    void closeConnect();//断开连接信号
    //connect(&w,SIGNAL(sendConnectSocket(QMap<int,QString>)),/*你定义的TCP连接类对象*/,SIGNAL/SLOT(/*对应的信号 或 槽处理函数*/));
    //connect(&w,SIGNAL(sendGroupPutWeighInfo(int,send_head)),/*你定义的TCP连接类对象*/,SIGNAL/SLOT(/*对应的信号 或 槽处理函数*/));
    //connect(&w,SIGNAL(sendGroupBatchInfo(int,send_head)),/*你定义的TCP连接类对象*/,SIGNAL/SLOT(/*对应的信号 或 槽处理函数*/));
    //connect(&w,SIGNAL(closeConnect()),/*你定义的TCP连接类对象*/,SIGNAL/SLOT(/*对应的信号 或 槽处理函数*/));
    //! [0]-end!
    w.show();
    return a.exec();
}
Example #23
0
CDiceView::CDiceView()
{
	// TODO: add construction code here
	initNodes();
	initPath();

	for(int i = 0; i<8; i++)
	{
		players[i].maxConnection = countMaxConnection(i);
		players[i].excessNum = 0;
		players[i].isMyTurn = false;
	}

	players[0].isMyTurn = true;

	chosenNode = -1;	

	btnClicked = false;

	ftInfo[0].country = -1;
	ftInfo[1].country = -1;

}
Example #24
0
KIconLoader::KIconLoader( ){

  QStrList list;

  config = KApplication::getKApplication()->getConfig();
  config->setGroup("KDE Setup");
  config->readListEntry( "IconPath", list, ':' );

  for (const char *it=list.first(); it; it = list.next())
    addPath(it);

  initPath();

  name_list.setAutoDelete(TRUE);
  pixmap_dirs.setAutoDelete(TRUE);
  pixmap_list.setAutoDelete(TRUE);

  /*
  for(char* c = pixmap_dirs.first(); c ; c = pixmap_dirs.next()){
    printf("()in path:%s\n",c);
  }
  */

}
Example #25
0
bool SimpleSolve::doSolve(Solver& s, const SolveParams& p) {
	s.stats.reset();
	Enumerator*  enumerator = s.sharedContext()->enumerator();
	bool hasWork    = true, complete = true;
	InitParams  init= p.init;
	SolveLimits lim = getSolveLimits();
	Timer<RealTime> tt; tt.start();
	s.sharedContext()->reportProgress(SolveStateEvent(s, "algorithm"));
	// Remove any existing assumptions and restore solver to a usable state.
	// If this fails, the problem is unsat, even under no assumptions.
	while (s.clearAssumptions() && hasWork) {
		// Add assumptions - if this fails, the problem is unsat 
		// under the current assumptions but not necessarily unsat.
		if (initPath(s, getInitialPath(), init)) {
			complete = (solvePath(s, p, lim) != value_free && s.decisionLevel() == s.rootLevel());
		}
		// finished current work item
		hasWork    = complete && enumerator->optimizeNext();
	}
	setSolveLimits(lim);
	tt.stop();
	s.sharedContext()->reportProgress(SolveStateEvent(s, "algorithm", tt.total()));
	return !complete;
}
Example #26
0
 Status GeoNearMatchExpression::init( const StringData& path, const NearQuery& query ) {
     _query = query;
     return initPath( path );
 }
Example #27
0
/* initialize state s (priority=0, cost=0, path=empty) */
void initState(State *s) {
  s->priority = 0;
  s->cost = 0;
  initPath(&s->path);
}
Example #28
0
bool LibTau::setModel(const std::string &model) {
	initPath(model);
	return true;
}
Example #29
0
 Status ElemMatchObjectMatchExpression::init( const StringData& path, const MatchExpression* sub ) {
     _sub.reset( sub );
     return initPath( path );
 }
Example #30
0
 Status SizeMatchExpression::init( const StringData& path, int size ) {
     _size = size;
     return initPath( path );
 }