/// <summary>Indexed setter for property components (index starts at 1 following HL7 convention).</summary> /// <param name="index">Index of the property (starts at 1 following HL7 convention). /// </param> /// <param name="component">New value of the property at <CODE>index</CODE>. /// /// </param> /// <throws> ProfileException </throws> public virtual void setComponent(int index, Component component) { index--; extendChildList(index); Component oldComponent = this.components[index]; this.components[index] = component; try { SupportClass.PropertyChangingEventArgs ve27 = new SupportClass.PropertyChangingEventArgs("components", null, null); } catch (System.ArgumentOutOfRangeException vetoException) { this.components[index] = oldComponent; throw new NuGenProfileException(null, vetoException); } SupportClass.PropertyChangingEventArgs me27 = new SupportClass.PropertyChangingEventArgs("components", null, null); }
/// <summary>Makes child list long enough to accommodate setter. </summary> private void extendChildList(int index) { if (index >= this.components.Length) { Component[] newCopy = new Component[index + 1]; Array.Copy(this.components, 0, newCopy, 0, this.components.Length); this.components = newCopy; } }
public virtual NuGenHL7Exception[] testComponent(Genetibase.NuGenHL7.model.Type type, Component profile, System.String profileID) { System.Collections.ArrayList exList = new System.Collections.ArrayList(20); addToList(testType(type, profile, null, profileID), exList); //test children if (profile.SubComponents > 0 && !profile.Usage.Equals("X") && hasContent(type)) { if (typeof(Composite).IsAssignableFrom(type.GetType())) { Composite comp = (Composite) type; for (int i = 1; i <= profile.SubComponents; i++) { SubComponent childProfile = profile.getSubComponent(i); try { Genetibase.NuGenHL7.model.Type child = comp.getComponent(i - 1); addToList(testType(child, childProfile, null, profileID), exList); } catch (DataTypeException de) { exList.Add(new NuGenProfileNotHL7CompliantException("More subcomponents in profile than allowed in message: " + de.Message)); } } addToList(checkExtraComponents(comp, profile.SubComponents), exList); } else { exList.Add(new NuGenProfileNotFollowedException("A component has primitive type " + type.GetType().FullName + " but the profile defines subcomponents")); } } return toArray(exList); }