コード例 #1
0
        /// <summary>
        /// Expression of the case
        /// </summary>
        public bool EvaluatePreConditions(InterpretationContext context)
        {
            bool retVal = true;

            foreach (DataDictionary.Rules.PreCondition preCondition in PreConditions)
            {
                Interpreter.Expression expression = preCondition.ExpressionTree;
                Values.BoolValue       value      = expression.GetValue(context) as Values.BoolValue;

                if (value != null)
                {
                    retVal = retVal && value.Val;
                }
                else
                {
                    retVal = false;
                }

                if (!retVal)
                {
                    break;
                }
            }
            return(retVal);
        }
コード例 #2
0
        /// <summary>
        /// Provides the actual value for the preconditions
        /// </summary>
        /// <param name="context">The context on which the precondition must be evaluated</param>
        /// <returns></returns>
        public bool EvaluatePreConditions(Interpreter.InterpretationContext context)
        {
            bool retVal = true;

            foreach (DataDictionary.Rules.PreCondition preCondition in PreConditions)
            {
                try
                {
                    Interpreter.Expression expression = preCondition.ExpressionTree;
                    Values.BoolValue       value      = expression.GetValue(context) as Values.BoolValue;
                    if (value != null)
                    {
                        retVal = retVal && value.Val;
                    }
                    else
                    {
                        retVal = false;
                        // TODO : Handle Error
                    }

                    if (!retVal)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    preCondition.AddException(e);
                    retVal = false;
                    break;
                }
            }

            return(retVal);
        }
コード例 #3
0
        /// <summary>
        /// Parses the image and provides the corresponding value
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public override Values.IValue getValue(string image)
        {
            Values.IValue retVal = null;

            Interpreter.Expression expression = EFSSystem.Parser.Expression(this, image);
            if (expression != null)
            {
                retVal = expression.GetValue(new Interpreter.InterpretationContext(this));
            }

            return(retVal);
        }
コード例 #4
0
        /// <summary>
        /// Gets a value based on its image
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public override Values.IValue getValue(string image)
        {
            Values.IValue retVal = null;

            Interpreter.Expression expression = EFSSystem.Parser.Expression(this, image);
            Types.Type             type       = expression.GetExpressionType() as Types.Type;
            if (type != null && Match(type))
            {
                retVal = expression.GetValue(new Interpreter.InterpretationContext());
            }

            return(retVal);
        }