/// <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> v2 = stack.Pop(); KeyValuePair <ILogicOperation, ILogicResult> v1 = stack.Pop(); ILogicResult result = new LogicResult(0); ILogicOperation op = new LogicOperation("LinearEqual"); op.Add(v2.Key); op.Add(v1.Key); if (v1.Value.CompareTo(v2.Value) != 0) { result = new LogicResult(v2.Value.ToInt32 - v1.Value.ToInt32); } op.Result = result.ToString(); stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, result)); }
/// <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)); }
/// <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> v2 = stack.Pop(); KeyValuePair <ILogicOperation, ILogicResult> v1 = stack.Pop(); ILogicOperation op = new LogicOperation("BitwiseAndTrue"); op.Add(v2.Key); op.Add(v1.Key); ILogicResult result = new LogicResult(LogicResult.MinValue); if (v1.Value.And(v2.Value).NotZero) { result = new LogicResult(0); } op.Result = result.ToString(); stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, result)); }
/// <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("AbsoluteUpper"); op.Add(v3.Key); op.Add(v2.Key); op.Add(v1.Key); ILogicResult above = new LogicResult(0); if (v1.Value.CompareTo(v2.Value) == 1) { above = new LogicResult(v3.Value.ToInt32); } op.Result = above.ToString(); stack.Push(new KeyValuePair <ILogicOperation, ILogicResult>(op, above)); }
/// <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)); }
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)); }
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)); }