public bool CalculateIfExcessGuideline(AnalyteGuidelineValue guideline, double?value, ComparisonOperation operation)
        {
            var decider    = _factory.BuildDecider(guideline.GetType());
            var isExcessed = decider.CalculateIfExcessGuideline(guideline, value, operation);

            return(isExcessed);
        }
示例#2
0
        public bool CalculateIfExcessGuideline(AnalyteGuidelineValue guideline, double?value, ComparisonOperation operation)
        {
            if (!IsSupported(guideline, operation))
            {
                throw new ArgumentException("guideine type or the comparison operation is not supported by the " + this.GetType().Name);
            }

            var castedGuideline = (SimpleGuidelineValue)guideline;

            if (value.HasValue && castedGuideline.GuidelineValue.HasValue)
            {
                var operationSymbol  = GetOperationSymbol(operation);
                var expressionString = String.Format("{0} {1} {2}", value.Value, operationSymbol, castedGuideline.GuidelineValue.Value);

                var expression = new Expression(expressionString);
                var result     = (bool)expression.Evaluate();

                return(!result);
            }

            return(false);
        }
示例#3
0
 public bool IsSupported(AnalyteGuidelineValue guideline, ComparisonOperation operation)
 {
     return((guideline is SimpleGuidelineValue) && Constants.LinearOperations.Contains(operation));
 }