예제 #1
0
        public override ExpressionVariant Evaluate(ref ExpressionEvaluationContext context)
        {
            var cond = Condition.Evaluate(ref context);

            if (cond.Type == VariantType.Boolean && cond.Boolean)
            {
                return(TruePart.Evaluate(ref context));
            }
            return(FalsePart.Evaluate(ref context));
        }
예제 #2
0
 protected override void Execute()
 {
     if (BoolExpression())
     {
         TruePart.ExecuteStep();
         Result = TruePart.Result;
     }
     else
     {
         FalsePart.ExecuteStep();
         Result = FalsePart.Result;
     }
 }
예제 #3
0
        public override string ToString()
        {
            StringBuilder sb             = new StringBuilder();
            bool          addParentheses = Condition.particles.First().Operation == Constructor.dbOpe.Qry;
            string        strCondition   = (addParentheses ? "( " : "") + Condition.ToString() + (addParentheses ? " )" : "");

            sb.AppendLine("IF " + strCondition + " BEGIN");
            sb.AppendLine(TruePart.ToString());
            sb.Append("END");
            if (FalsePart != null)
            {
                sb.AppendLine();
                sb.AppendLine("THEN BEGIN");
                sb.AppendLine(FalsePart.ToString());
                sb.Append("END");
            }
            return(sb.ToString());
        }
예제 #4
0
 public override string ToString()
 {
     return(Test.ToString() + " (" + TruePart.ToString() + ", " + FalsePart.ToString() + ")");
 }