ATMLModelLibrary.model.Physical.IsConfidence C# (CSharp) Method

IsConfidence() public static method

public static IsConfidence ( string word ) : bool
word string
return bool
        public static bool IsConfidence(string word)
        {
            return word.Trim().ToLower().StartsWith("conf");
        }

Usage Example

Example #1
0
        public ErrorLimit(string value, out string remainder)
        {
            string nextWord = remainder = value.Trim(); //Physical.NextWord(value, out remainder);

            if (nextWord.ToLower().StartsWith("errlmt"))
            {
                nextWord = Physical.NextWord(nextWord, out remainder).Trim();
            }
            if (remainder.StartsWith(Quantity.PLUSMINUS1))
            {
                nextWord       = remainder;
                _minusQuantity = new Quantity(Quantity.MINUS + nextWord.Substring(1), out remainder);
                _plusQuantity  = new Quantity(nextWord.Substring(1), out remainder);
            }
            else if (remainder.StartsWith(Quantity.PLUSMINUS2))
            {
                nextWord       = remainder;
                _minusQuantity = new Quantity(Quantity.MINUS + nextWord.Substring(2), out remainder);
                _plusQuantity  = new Quantity(nextWord.Substring(2), out remainder);
            }
            else if (remainder.StartsWith(Quantity.PLUS))
            {
                string plusVal = remainder.Substring(1);
                _plusQuantity = new Quantity(plusVal, out remainder);
                if (remainder.StartsWith(Quantity.MINUS))
                {
                    _minusQuantity = new Quantity(remainder, out remainder);
                }
                else if (remainder.Length > 0 && Char.IsNumber(remainder[0]))
                {
                    throw new Exception(string.Format("Missing sign on the second error limit value. {0}", remainder));
                }
                else
                {
                    _plusQuantity = new Quantity(Quantity.MINUS + plusVal, out remainder);
                }
            }
            else if (remainder.StartsWith(Quantity.MINUS))
            {
                string minusVal = remainder;
                _minusQuantity = new Quantity(minusVal, out remainder);
                if (remainder.StartsWith(Quantity.PLUS))
                {
                    _plusQuantity = new Quantity(remainder.Substring(1), out remainder);
                }
                else if (remainder.Length > 0 && Char.IsNumber(remainder[0]))
                {
                    throw new Exception(string.Format("Missing sign on the second error limit value. {0}", remainder));
                }
                else
                {
                    _plusQuantity = new Quantity(minusVal.Substring(1), out remainder);
                }
            }
            else
            {
                nextWord       = remainder;
                _minusQuantity = new Quantity(Quantity.MINUS + nextWord, out remainder);
                _plusQuantity  = new Quantity(nextWord, out remainder);
            }

            if (!string.IsNullOrEmpty(remainder) && Physical.IsConfidence(remainder))
            {
                string key = Physical.NextWord(remainder, out remainder);
                _confidence = new Quantity(remainder, out remainder);
            }

            if (!string.IsNullOrEmpty(remainder) && Physical.IsResolution(remainder))
            {
                string key = Physical.NextWord(remainder, out remainder);
                _resolution = new Quantity(remainder, out remainder);
            }

            if (_confidence != null)
            {
                _confidence.ValueChanged += delegate { OnValueChanged(); }
            }
            ;
            if (_plusQuantity != null)
            {
                _plusQuantity.ValueChanged += delegate { OnValueChanged(); }
            }
            ;
            if (_minusQuantity != null)
            {
                _minusQuantity.ValueChanged += delegate { OnValueChanged(); }
            }
            ;
            if (_resolution != null)
            {
                _resolution.ValueChanged += delegate { OnValueChanged(); }
            }
            ;
        }