Beispiel #1
0
        private void GetWordByKeyWord(Queue <string> qWord, string keyWord, int nIndex, AutoCompleteNode node)
        {
            if (nIndex >= keyWord.Length)
            {
                return;
            }
            if (node._Char != keyWord[nIndex])
            {
                return;
            }

            if (true == node.IsWord)
            {
                string word = keyWord.Substring(0, nIndex);
                qWord.Enqueue(word);
            }

            nIndex++;

            foreach (AutoCompleteNode childNode in node.NodeList)
            {
                GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
            }
        }
Beispiel #2
0
        private void GetWordByKeyWord(Queue <string> qWord, STAGE_TYPE stage, bool isSuite, string keyWord)
        {
            int nIndex = 0;

            AutoCompleteNode curNode = null;

            switch (stage)
            {
            case STAGE_TYPE.ST_1:
            {
                curNode = (true == isSuite) ? stage1SuiteNode : stage1TestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
            }
            break;

            case STAGE_TYPE.ST_2:
            {
                curNode = (true == isSuite) ? stage2SuiteNode : stage2TestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
            }
            break;

            case STAGE_TYPE.ST_3:
            {
                curNode = (true == isSuite) ? stage3SuiteNode : stage3TestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
            }
            break;

            case STAGE_TYPE.ST_DB:
            {
                curNode = (true == isSuite) ? DBSuiteNode : DBTestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
            }
            break;

            case STAGE_TYPE.ST_ALL:
            {
                curNode = (true == isSuite) ? stage1SuiteNode : stage1TestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
                curNode = (true == isSuite) ? stage2SuiteNode : stage2TestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
                curNode = (true == isSuite) ? stage3SuiteNode : stage3TestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
                curNode = (true == isSuite) ? DBSuiteNode : DBTestNode;
                foreach (AutoCompleteNode childNode in curNode.NodeList)
                {
                    GetWordByKeyWord(qWord, keyWord, nIndex, childNode);
                }
            }
            break;

            default: return;
            }
        }