Пример #1
0
        public IState Process(char @char)
        {
            IState next = null;

            switch (@char)
            {
            case '<':
                next = new GarbageState(Context.Push(this));
                break;

            case '}':
                Context.GroupCount += Context.GetGroupScore() + 1;
                next = Context.Pop();
                break;

            case '{':
                next = new GroupState(Context.Push(this));
                break;

            default:
                next = this;
                break;
            }
            return(next);
        }
Пример #2
0
        public IState Process(char @char)
        {
            IState next = null;

            switch (@char)
            {
            case '{':
                next = new GroupState(Context.Push(this));
                break;

            case '<':
                next = new GarbageState(Context.Push(this));
                break;

            default:
                next = this;
                break;
            }
            return(next);
        }