예제 #1
0
        public void AcceptValues(IList values)
        {
            var functionName = (string)values[0];

            values.RemoveAt(0);

            var arr = new ParseTreeElement[values.Count];

            values.CopyTo(arr, 0);
            Array.Reverse(arr);

            _args         = arr;
            _functionName = functionName;
        }
예제 #2
0
        public override void AddAsRPN(IList dest)
        {
            ParseTreeElement element = _args[0];

            element.AddAsRPN(dest);
            element = _args[1];
            element.AddAsRPN(dest);
            dest.Add(_operations[0]);

            int opIndex = 1;

            for (int i = 2; i <= _args.Length - 1; i++)
            {
                element = _args[i];
                element.AddAsRPN(dest);
                dest.Add(_operations[opIndex]);
                opIndex += 1;
            }
        }
예제 #3
0
 public UnaryOperatorElement(UnaryOperator @operator, ParseTreeElement argument)
 {
     _operator = @operator;
     _argument = argument;
 }