Ejemplo n.º 1
0
        /// <summary>
        /// The min, max, add, sub nodes all expect two nodes that have one result on its leaf
        /// </summary>
        /// <param name="data"></param>
        /// <param name="stack"></param>
        /// <returns></returns>
        public override void Parse(object data, ILogicStack stack)
        {
            base.Parse(data, stack);

            KeyValuePair <ILogicOperation, ILogicResult> v2 = stack.Pop();
            KeyValuePair <ILogicOperation, ILogicResult> v1 = stack.Pop();

            ILogicOperation op = new LogicOperation("LinearLower");

            op.Add(v2.Key);
            op.Add(v1.Key);
            ILogicResult below = new LogicResult(0);

            if (v1.Value.CompareTo(v2.Value) == -1)
            {
                below = v1.Value.Subtract(v2.Value);
            }
            op.Result = below.ToString();
            stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, below));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The min, max, add, sub nodes all expect two nodes that have one result on its leaf
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public override void Parse(object data, ILogicStack stack)
        {
            base.Parse(data, stack);

            KeyValuePair <ILogicOperation, ILogicResult> v3 = stack.Pop();
            KeyValuePair <ILogicOperation, ILogicResult> v2 = stack.Pop();
            KeyValuePair <ILogicOperation, ILogicResult> v1 = stack.Pop();

            ILogicOperation op = new LogicOperation("AbsoluteEqual");

            op.Add(v3.Key);
            op.Add(v2.Key);
            op.Add(v1.Key);
            ILogicResult notequal = new LogicResult(0);

            if (v1.Value.CompareTo(v2.Value) != 0)
            {
                notequal.Value = v3.Value.ToInt32;
            }

            op.Result = notequal.ToString();
            stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, notequal));
        }