/// <summary>
        /// Computes the changes related to this event
        /// </summary>
        /// <param name="apply">Indicates that the changes should be applied directly</param>
        public override bool ComputeChanges(bool apply)
        {
            bool retVal = base.ComputeChanges(apply);

            if (retVal)
            {
                Explanation         = new Interpreter.ExplanationPart(Action);
                Explanation.Message = "Action " + Action.Name;
                Interpreter.InterpretationContext context = new Interpreter.InterpretationContext(Instance);
                Changes = new ChangeList();
                Action.GetChanges(context, Changes, Explanation, apply);
                Changes.CheckChanges(Action);
                Message = Explanation.ToString();
            }

            return(retVal);
        }
Example #2
0
 /// <summary>
 /// Provides the changes performed by this statement
 /// </summary>
 /// <param name="context">The context on which the changes should be computed</param>
 /// <param name="changes">The changes performed by this statement</param>
 /// <param name="explanation">The explanatino to fill, if any</param>
 /// <param name="apply">Indicates that the changes should be applied immediately</param>
 public abstract void GetChanges(Interpreter.InterpretationContext context, ChangeList changes, Interpreter.ExplanationPart explanation, bool apply);
        /// <summary>
        /// Computes the changes related to this event
        /// </summary>
        /// <param name="apply">Indicates that the changes should be applied directly</param>
        public override bool ComputeChanges(bool apply)
        {
            bool retVal = base.ComputeChanges(apply);

            if (retVal)
            {
                Explanation = new Interpreter.ExplanationPart(Action);
                Explanation.Message = "Action " + Action.Name;
                Interpreter.InterpretationContext context = new Interpreter.InterpretationContext(Instance);
                Changes = new ChangeList();
                Action.GetChanges(context, Changes, Explanation, apply);
                Changes.CheckChanges(Action);
                Message = Explanation.ToString();
            }

            return retVal;
        }
Example #4
0
        /// <summary>
        /// Creates a list of changes to be applied on the system
        /// </summary>
        /// <param name="context">The context on which the changes should be computed</param>
        /// <param name="changes">The list of changes to be updated</param>
        /// <param name="explanation">The explanatino to fill, if any</param>
        /// <param name="apply">Indicates that the changes should be applied immediately</param>
        /// <returns>The list to fill with the changes</param>
        public void GetChanges(Interpreter.InterpretationContext context, ChangeList changes, Interpreter.ExplanationPart explanation, bool apply)
        {
            long start = System.Environment.TickCount;

            try
            {
                if (Statement != null)
                {
                    Statement.GetChanges(context, changes, explanation, apply);
                }
                else
                {
                    AddError("Invalid actions statement");
                }
            }
            catch (Exception e)
            {
                AddException(e);
            }

            long stop = System.Environment.TickCount;
            long span = (stop - start);

            if (RuleCondition != null && RuleCondition.EnclosingRule != null)
            {
                // Rule execution execution time (as opposed to guard evaluation)
                RuleCondition.EnclosingRule.ExecutionTimeInMilli += span;
                RuleCondition.EnclosingRule.ExecutionCount       += 1;
            }
        }