Beispiel #1
0
        protected void ValidateBase(ExprOperator exprOperator)
        {
            this.ValidateBase((ExprItem)exprOperator);

            Invariant(exprOperator.Operator != null,
                string.Format(CommonStrings.XMustNotBeNull, "ExprOperator.Operator"));
            this.Validate(exprOperator.Operator);
        }
Beispiel #2
0
        protected void Validate(ExprOperator exprOperator)
        {
            if (exprOperator == null) throw new ArgumentNullException(
                string.Format(CommonStrings.XIsNull, "exprOperator"));

            const string methodName = "Validate";

            try
            {
                System.Reflection.MethodInfo method = this.GetType().GetMethod(methodName,
                    System.Reflection.BindingFlags.ExactBinding | System.Reflection.BindingFlags.NonPublic
                    | System.Reflection.BindingFlags.Instance, Type.DefaultBinder,
                               new Type[] { exprOperator.GetType() },
                               new System.Reflection.ParameterModifier[0]);

                if (method != null)
                {
                   if (method != lastExprOperatorMethod || exprOperator != lastExprOperator)
                    {
                        lastExprOperatorMethod = method;
                        lastExprOperator = exprOperator;

                        method.Invoke(this, new Object[] { exprOperator });

                    }
                    else
                    {
                        string message = string.Format(CommonStrings.LoopingMethodTerminated,
                             methodName, exprOperator.GetType().ToString());
                        System.Diagnostics.Debug.WriteLine(message);
                        throw new ApplicationException(message);
                    }
                }
                else
                {
                    string message = string.Format(CommonStrings.MethodXNotImplementedForParamTypeY,
                             methodName, exprOperator.GetType().ToString());
                    System.Diagnostics.Debug.WriteLine(message);
                    throw new ApplicationException(message);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                    if (ex.InnerException is ApplicationException && ex.InnerException.InnerException != null
                            && ex.InnerException.Message == ex.InnerException.InnerException.Message)
                        throw new ApplicationException(ex.InnerException.Message, ex.InnerException.InnerException);
                    else
                        throw new ApplicationException(ex.InnerException.Message, ex.InnerException);
                else
                    throw new ApplicationException(ex.Message, ex);
            }
        }
Beispiel #3
0
        private void WriteXmlBase(ExprOperator exprOperator)
        {
            Check.Require(exprOperator != null, string.Format(CommonStrings.XMustNotBeNull, "exprOperator"));
            Check.Require(exprOperator.Operator != null, string.Format(CommonStrings.XMustNotBeNull, "exprOperator.Operator"));

            this.WriteXmlBase((ExprItem)exprOperator);
            writer.WriteElementString(UseOpenEhrPrefix(writer), "operator", OpenEhrNamespace, exprOperator.Operator.Value.ToString());
            writer.WriteElementString(UseOpenEhrPrefix(writer), "precedence_overridden", OpenEhrNamespace, exprOperator.PrecedenceOverriden.ToString().ToLower());
        }
Beispiel #4
0
 internal PredicateExpr(ExprOperator predicate)
 {
     this.predicate = predicate;
 }
Beispiel #5
0
        private void ReadXmlBase(ExprOperator exprOperator)
        {
            this.ReadXmlBase((ExprItem)exprOperator);

            if (reader.LocalName != "operator")
                throw new InvalidXmlException("operator", reader.LocalName);
            exprOperator.Operator = new OperatorKind(reader.ReadElementContentAsInt("operator", OpenEhrNamespace));
            reader.MoveToContent();

            if (reader.LocalName != "precedence_overridden")
                throw new InvalidXmlException("precedence_overridden", reader.LocalName);
            exprOperator.PrecedenceOverriden = reader.ReadElementContentAsBoolean("precedence_overridden", OpenEhrNamespace);
            reader.MoveToContent();
        }