コード例 #1
0
        protected ExpEvalResultType EvaluateExpressionTree(ref ExpressionTree expressionTree, ref object rValObject)
        {
            ExpEvalResultType res = ExpEvalResultType.Empty;

            foreach (var op in ExpressionTree.Nodes)
            {
                res = op.Evaluate(ref rValObject);
                bool toBreak = false;
                switch (res)
                {
                case ExpEvalResultType.False:
                {
                    if (op.With == LogicalOpType.And)
                    {
                        toBreak = true;
                    }
                }
                break;

                case ExpEvalResultType.Invalid:
                    toBreak = true;
                    break;

                case ExpEvalResultType.True:
                    if (op.With == LogicalOpType.Or)
                    {
                        toBreak = true;
                    }
                    break;

                default:
                    toBreak = true;
                    break;
                }
                if (toBreak)
                {
                    break;
                }
            }
            return(res);
        }
コード例 #2
0
 /// <summary>
 /// Add innerexpression.
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="innerExpression"></param>
 /// <param name="logicalOp"></param>
 /// <returns></returns>
 public static DecisionExpression AddInnerExpression(this DecisionExpression obj, ExpressionTree innerExpression, LogicalOpType logicalOp)
 {
     if (obj.InnerExpressions == null)
     {
         obj.InnerExpressions = new List <InnerExpEval>();
     }
     obj.InnerExpressions.Add(new InnerExpEval {
         With = logicalOp, Expression = innerExpression
     });
     return(obj);
 }