Esempio n. 1
0
        /**
         * 处理文本
         *
         * @param text      文本
         * @param processor 处理器
         */
        public void parseText(String text, IHit <V> processor)
        {
            int position     = 1;
            int currentState = 0;

            for (int i = 0; i < text.Length; ++i)
            {
                currentState = getState(currentState, text[i]);
                int[] hitArray = output[currentState];
                if (hitArray != null)
                {
                    foreach (int hit in hitArray)
                    {
                        processor.hit(position - l[hit], position, v[hit]);
                    }
                }
                ++position;
            }
        }
Esempio n. 2
0
        /**
         * 处理文本
         *
         * @param text
         * @param processor
         */
        public void parseText(char[] text, IHit <V> processor)
        {
            int position     = 1;
            int currentState = 0;

            foreach (char c in text)
            {
                currentState = getState(currentState, c);
                int[] hitArray = output[currentState];
                if (hitArray != null)
                {
                    foreach (int hit in hitArray)
                    {
                        processor.hit(position - l[hit], position, v[hit]);
                    }
                }
                ++position;
            }
        }