/// <summary> /// Provides the actual value for the preconditions /// </summary> /// <param name="context">The context on which the precondition must be evaluated</param> /// <param name="explanation">The explanation part to fill, if any</param> /// <param name="log">indicates that this should be logged</param> /// <param name="runner"></param> /// <returns></returns> public bool EvaluatePreConditions(InterpretationContext context, ExplanationPart explanation, Runner runner) { bool retVal = true; foreach (PreCondition preCondition in PreConditions) { try { ExplanationPart subExplanation = ExplanationPart.CreateNamedSubExplanation(explanation, "PreCondition ", preCondition); BoolValue value = preCondition.Expression.GetExpressionValue(context, subExplanation) as BoolValue; ExplanationPart.SetNamable(subExplanation, value); if (value != null) { retVal = retVal && value.Val; } else { retVal = false; // TODO : Handle Error } if (!retVal) { break; } } catch (Exception e) { preCondition.Expression.AddErrorAndExplain(e.Message, explanation); retVal = false; break; } } return(retVal); }