Esempio n. 1
0
        public bool Validate(out string validateMessage, out Rule rule)
        {
            bool result = true;

            rule = new Rule();

            validateMessage = "Rule Ok";

            if (m_ConditionContainer.m_ConditionList.Count > 0)
            {
                GraphToRule converter = new GraphToRule(m_TargetObject.GetComponent <State>() as State);

                rule.m_Rule = converter.Convert(m_Rule.m_Name, m_ConditionContainer.m_ConditionList[0], m_ActionContainer.m_ActionList);
                rule.SetContext(m_TargetObject.GetComponent <InferenceEngine>() as InferenceEngine);

                try
                {
                    result = rule.Validate();
                }
                catch (InvalidRuleException e)
                {
                    validateMessage = e.Message;
                }
            }

            return(result);
        }
		public bool Validate(out string validateMessage, out Rule rule)
		{
			bool result = true;
			rule = new Rule();
	
			validateMessage = "Rule Ok";

			if (m_ConditionContainer.m_ConditionList.Count > 0)
			{
				GraphToRule converter = new GraphToRule(m_TargetObject.GetComponent<State>() as State);

				rule.m_Rule = converter.Convert(m_Rule.m_Name, m_ConditionContainer.m_ConditionList[0], m_ActionContainer.m_ActionList);
	            rule.SetContext(m_TargetObject.GetComponent<InferenceEngine>() as InferenceEngine);

				try
				{
					result = rule.Validate();
				}
				catch (InvalidRuleException e)
				{
					validateMessage = e.Message;
				}
			}

			return result;
		}