Beispiel #1
0
        private bool PopTwiceAndPush(StorageFunction <T> func)
        {
            if (!CanPop(2))
            {
                return(false);
            }

            var first = Pop();
            var last  = Pop();

            Push(func(last, first));
            return(true);
        }
Beispiel #2
0
        public Storage(
            StorageFunction <T> add,
            StorageFunction <T> sub,
            StorageFunction <T> mul,
            StorageFunction <T> mod,
            StorageFunction <T> per,
            StorageComparer <T> eq,
            StorageComparer <T> bigeq,
            StorageTFromInt <T> inttot)
        {
            _add    = add;
            _sub    = sub;
            _mul    = mul;
            _div    = mod;
            _mod    = per;
            _eq     = eq;
            _bigeq  = bigeq;
            _inttot = inttot;

            _stacks = new Dictionary <char, Stack <T> >(28)
            {
                { ' ', new Stack <T>() },
                { 'ㄱ', new Stack <T>() },
                { 'ㄴ', new Stack <T>() },
                { 'ㄷ', new Stack <T>() },
                { 'ㄹ', new Stack <T>() },
                { 'ㅁ', new Stack <T>() },
                { 'ㅂ', new Stack <T>() },
                { 'ㅅ', new Stack <T>() },
                { 'ㅈ', new Stack <T>() },
                { 'ㅊ', new Stack <T>() },
                { 'ㅋ', new Stack <T>() },
                { 'ㅌ', new Stack <T>() },
                { 'ㅍ', new Stack <T>() },
                { 'ㄲ', new Stack <T>() },
                { 'ㄳ', new Stack <T>() },
                { 'ㄵ', new Stack <T>() },
                { 'ㄶ', new Stack <T>() },
                { 'ㄺ', new Stack <T>() },
                { 'ㄻ', new Stack <T>() },
                { 'ㄼ', new Stack <T>() },
                { 'ㄽ', new Stack <T>() },
                { 'ㄾ', new Stack <T>() },
                { 'ㄿ', new Stack <T>() },
                { 'ㅀ', new Stack <T>() },
                { 'ㅄ', new Stack <T>() },
                { 'ㅆ', new Stack <T>() },
                { 'ㅎ', new Stack <T>() }
            };
            _queue = new List <T>();
        }