Exemple #1
0
        public ILogicResult Combine(ILogicResult other)
        {
            LogicResult result = new LogicResult(this.PassRating + other.PassRating);

            this.type = 1;
            return(result);
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #4
0
        public ILogicResult Add(ILogicResult other)
        {
            LogicResult result = new LogicResult(this.ToInt32 + other.ToInt32);

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

            return(result);
        }