public virtual NuGenHL7Exception[] testField(Genetibase.NuGenHL7.model.Type type, Field profile, bool escape, System.String profileID)
		{
			System.Collections.ArrayList exList = new System.Collections.ArrayList(20);
			
			//account for MSH 1 & 2 which aren't escaped
			System.String encoded = null;
			if (!escape && typeof(Primitive).IsAssignableFrom(type.GetType()))
				encoded = ((Primitive) type).Value;
			
			addToList(testType(type, profile, encoded, profileID), exList);
			
			//test children
			if (profile.Components > 0 && !profile.Usage.Equals("X"))
			{
				if (typeof(Composite).IsAssignableFrom(type.GetType()))
				{
					Composite comp = (Composite) type;
					for (int i = 1; i <= profile.Components; i++)
					{
						Component childProfile = profile.getComponent(i);
						try
						{
							Genetibase.NuGenHL7.model.Type child = comp.getComponent(i - 1);
							addToList(testComponent(child, childProfile, profileID), exList);
						}
						catch (DataTypeException de)
						{
							exList.Add(new NuGenProfileNotHL7CompliantException("More components in profile than allowed in message: " + de.Message));
						}
					}
					addToList(checkExtraComponents(comp, profile.Components), exList);
				}
				else
				{
					exList.Add(new NuGenProfileNotHL7CompliantException("A field has type primitive " + type.GetType().FullName + " but the profile defines components"));
				}
			}
			
			return toArray(exList);
		}
		/// <summary>This method builds a Conformance Field Class</summary>
		/// <param name="field">the Field to build
		/// </param>
		/// <param name="parentUnderlyingType">the data type of the parent Segment for this field
		/// example "Genetibase.NuGenHL7.model.v24.segment.MSH"  
		/// </param>
		/// <param name="profileName"> ProfileName
		/// </param>
		public virtual void  buildClass(Field field, System.String parentUnderlyingType, ProfileName profileName)
		{
			GeneratedConformanceContainer gcc = new GeneratedConformanceContainer();
			GeneratedMethod gm = new GeneratedMethod();
			
			// Check for possible snags in the Runtime Profile Segment
			if (field.Name == null || field.Name.Length < 1)
				throw new ConformanceError("Error building ConformanceField: Runtime Field does not contain a name.");
			
			// Set up class
			gcc.ClassPackage = packageName;
			gcc.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*");
			gcc.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*");
			gcc.addClassImport("Genetibase.NuGenHL7.model.*");
			gcc.addClassImport("Genetibase.NuGenHL7.*");
			
			if (field.Components > 0)
				gcc.addClassImport(packageName + "." + profileName.PackageName + ".*");
			
			gcc.Name = profileName.ClassName;
			
			gcc.Properties = "extends AbstractConformanceContainer implements Repeatable";
			gcc.setMinMaxReps(field.Min, field.Max);
			underlyingType = "Genetibase.NuGenHL7.model." + versionString + ".datatype." + field.Datatype;
			gcc.addMemberVariable(underlyingType + " hapiType;");
			gcc.addMemberVariable("private final short MAX_LENGTH = " + field.Length + ";");
			gm.ReturnType = "long";
			gm.Visibility = "public";
			gm.Name = "getMaxLength";
			gm.addToBody("return this.MAX_LENGTH;");
			docBuilder.decorateMaxLength(gm);
			gcc.addMethod(gm);
			
			// Set up underlying Field type
			gcc.Constructor.addParam(parentUnderlyingType + " hapiSegment", "The underlying HAPI field object");
			
			gcc.Constructor.addParam("int rep", "The desired repetition");
			gcc.Constructor.addToBody("try {");
			
			UnderlyingAccessor underlyingAccessor = new UnderlyingAccessor(parentUnderlyingType, profileName.AccessorName);
			gcc.Constructor.addToBody("   this.hapiType = hapiSegment." + underlyingAccessor + ";");
			
			docBuilder.decorateConstructor(gcc.Constructor, profileName.ClassName);
			
			// Create the getters and member variables associated with each child
			for (int i = 1; i <= field.Components; i++)
			{
				//don't build not supported, backward, or unknown types
				System.String usage = field.getComponent(i).Usage;
				if (usage != null && (usage.Equals("X") || usage.Equals("B") || usage.Equals("U")))
					continue;
				
				bool hasChildren = (field.getComponent(i).SubComponents > 0)?true:false;
				ProfileName childProfileName = new ProfileName(field.getComponent(i).Name, ProfileName.PS_COMP);
				gcc.addComponent(childProfileName, (short) (i - 1), hasChildren);
			}
			
			gcc.Constructor.addToBody("} catch ( HL7Exception e ) {");
			gcc.Constructor.addToBody("   throw new ConformanceError( \"Invalid Attempt to access a rep. This is a bug.\" );");
			gcc.Constructor.addToBody("}");
			
			// Decorate with comments
			docBuilder.decorateField(gcc, field);
			
			if (depManager.Verbose)
				System.Console.Out.WriteLine("Generating Field: " + packageName + "." + gcc.Name);
			
			// Create the components
			for (int i = 1; i <= field.Components; i++)
			{
				if (field.getComponent(i).SubComponents == 0)
				{
					ConformancePrimitiveBuilder childBuilder = new ConformancePrimitiveBuilder(packageName + "." + profileName.PackageName, depManager);
					childBuilder.buildClass(field.getComponent(i), ProfileName.PS_COMP);
				}
				else
				{
					ConformanceComponentBuilder childBuilder = new ConformanceComponentBuilder(packageName + "." + profileName.PackageName, depManager, versionString);
					childBuilder.buildClass(field.getComponent(i));
				}
			}
			depManager.generateFile(gcc, packageName, gcc.Name);
		}