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

Physical() public method

public Physical ( string value ) : System
value string
return System
        public Physical(string value)
        {
            Value = value;
            var rgx = new Regex(PHYSICAL_PATTERN);
            if (!rgx.Match(value).Success)
                throw new Exception(string.Format("Invalid Physical Expression - {0}", value));
            if( value.Contains( " to " ) && !value.Contains( "range" ))
                throw new Exception(string.Format("Invalid Physical Range - {0}, please prefix a range of values with \"range \"", value));
            string remainder = value;
            string word = NextWord(remainder, out remainder);
            while (!string.IsNullOrWhiteSpace(word))
            {
                if (IsNumericExpression(word) || IsQualifier(word))
                {
                    _magnitude = new QualifiedQuantity(word + " " + remainder, out remainder);
                    AddQuantity(_magnitude);
                }
                else if (IsRange(word))
                {
                    var range = new RangingInformation(remainder, out remainder,
                        _magnitude == null ? 0d : _magnitude.Magnitude);
                    Ranges.Add(range);
                }
                else if (IsErrorLimit(word))
                {
                    ErrorLimits.Add(new ErrorLimit(remainder, out remainder));
                }
                else if (IsResolution(word))
                {
                    Resolutions.Add(new Quantity(remainder, out remainder));
                }
                else if (IsConfidence(word))
                {
                }
                else if (IsLoad(word))
                {
                }
                word = NextWord(remainder, out remainder);
            }
        }