public CodableValue(string text, CodedValue code)
        {
            if (text == null)
            {
                throw new ArgumentException("text");
            }

            Text = text;
            AddCode(code);
        }
 public CodedValue(CodedValue source) : this()
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     Code = source.Code;
     VocabFamily = source.VocabFamily;
     VocabName = source.VocabName;
     VocabVersion = source.VocabVersion;
 }
        public StructuredNameValue(CodedValue name, StructuredMeasurement measurement)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (measurement == null)
            {
                throw new ArgumentNullException("value");
            }

            Name = name;
            Value = measurement;
        }
 private void AddCode(CodedValue code)
 {
     if (code != null)
     {
         Codes.Add(code);
     }
 }
        public void Replace(string newText, CodedValue newCode)
        {
            if (string.IsNullOrEmpty(newText))
            {
                throw new ArgumentException("newText");
            }

            Text = newText;
            ClearCodes();
            AddCode(newCode);
        }
        public void Update(string updatedText, CodedValue code)
        {
            if (string.IsNullOrEmpty(updatedText))
            {
                throw new ArgumentException("newText");
            }

            if (MatchesText(updatedText))
            {
                // Same text. We'll keep any existing codes that merge in the new code
                if (code != null)
                {
                    Codes.AddIfDoesNotExist(code);
                }
            }
            else
            {
                // Text is different. 
                Replace(updatedText, code);
            }
        }