Ejemplo n.º 1
0
        public ILogicResult Combine(ILogicResult other)
        {
            LogicResult result = new LogicResult(this.PassRating + other.PassRating);

            this.type = 1;
            return(result);
        }
Ejemplo n.º 2
0
        public override void Parse(object data, ILogicStack stack)
        {
            ILogicResult    sum = new LogicResult(0);
            ILogicOperation op  = new LogicOperation("Add", true);

            foreach (ILogicNode node in this)
            {
                node.Parse(data, stack);
                KeyValuePair <ILogicOperation, ILogicResult> item = stack.Pop();
                sum = sum.Add(item.Value);
                if (item.Key != null)
                {
                    op.Add(item.Key);
                }
            }
            op.Result = sum.ToString();
            stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, sum));
        }
Ejemplo n.º 3
0
        public override void Parse(object data, ILogicStack stack)
        {
            ILogicOperation op = new LogicOperation("Min");
            ILogicResult    r1 = new LogicResult(LogicResult.MaxValue);

            foreach (ILogicNode node in this)
            {
                node.Parse(data, stack);
                KeyValuePair <ILogicOperation, ILogicResult> r = stack.Pop();
                if (r.Value.CompareTo(r1) < 0)
                {
                    // Set the minimum
                    r1.Value = r.Value.Value;
                }
                op.Add(r.Key);
            }
            op.Result = r1.Value.ToString();
            stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, r1));
        }
Ejemplo n.º 4
0
        public ILogicResult Add(ILogicResult other)
        {
            LogicResult result = new LogicResult(this.ToInt32 + other.ToInt32);

            return(result);
        }
Ejemplo n.º 5
0
        public ILogicResult Subtract(ILogicResult other)
        {
            LogicResult result = new LogicResult(this.ToInt32 - other.ToInt32);

            return(result);
        }