当前位置: 首页>>代码示例>>C#>>正文


C# Segment.numFields方法代码示例

本文整理汇总了C#中Segment.numFields方法的典型用法代码示例。如果您正苦于以下问题:C# Segment.numFields方法的具体用法?C# Segment.numFields怎么用?C# Segment.numFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Segment的用法示例。


在下文中一共展示了Segment.numFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: copy

		/*    if (from instanceof Varies) {
		from = ((Varies) from).getData();
		}        
		if (to instanceof Varies) {
		to = ((Varies) to).getData();
		}
		if (from instanceof Primitive) {
		if (to instanceof Primitive) {
		copy((Primitive) from, (Primitive) to);
		} else {
		copy((Primitive) from, (Composite) to);                
		}
		} else {
		if (to instanceof Primitive) {
		copy((Composite) from, (Primitive) to);                
		} else {
		copy((Composite) from, (Composite) to);                
		}            
		}
		}*/
		
		/// <summary>Copies a primitive to a primitive </summary>
		/*private static void copy(Primitive from, Primitive to) throws DataTypeException {
		to.setValue(from.getValue());
		}*/
		
		/// <summary>Copies composite to composite - could be different # of components (extras either way are ignored) </summary>
		/*private static void copy(Composite from, Composite to) throws DataTypeException {
		Type[] froms = from.getComponents();
		Type[] tos = to.getComponents();
		int limit = Math.min(froms.length, tos.length);
		for (int i = 0; i < limit; i++) {
		copy(froms[i], tos[i]);
		}
		}*/
		
		/// <summary>Copies primitive to first component of composite.  </summary>
		/*private static void copy(Primitive from, Composite to) throws DataTypeException {
		Type firstComponent = to.getComponent(0);
		copy(from, firstComponent);
		}*/
		
		/// <summary>Copies first component of composite to a primitive </summary>
		/*private static void copy(Composite from, Primitive to) throws DataTypeException {
		Type firstComponent = from.getComponent(0);
		copy(firstComponent, to);
		}*/
		
		/// <summary> Copies contents from the source segment to the destination segment.  This 
		/// method calls copy(Type, Type) on each repetition of each field (see additional 
		/// behavioural description there).  An attempt is made to copy each repetition of 
		/// each field in the source segment, regardless of whether the corresponding 
		/// destination field is repeating or even exists.  
		/// </summary>
		/// <param name="from">the segment from which data are copied 
		/// </param>
		/// <param name="to">the segment into which data are copied
		/// </param>
		public static void  copy(Segment from, Segment to)
		{
			int n = from.numFields();
			for (int i = 1; i <= n; i++)
			{
				Genetibase.NuGenHL7.model.Type[] reps = from.getField(i);
				for (int j = 0; j < reps.Length; j++)
				{
					copy(reps[j], to.getField(i, j));
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:70,代码来源:NuGenDeepCopy.cs

示例2: checkForExtraFields

		/// <summary> Checks a segment against a list of allowed fields 
		/// (ie those mentioned in the profile with usage other than X).  Returns 
		/// a list of exceptions representing field that appear 
		/// but are not supposed to.  
		/// </summary>
		/// <param name="allowedFields">an array of Integers containing field #s of allowed fields
		/// </param>
		private NuGenHL7Exception[] checkForExtraFields(Segment segment, System.Collections.ArrayList allowedFields)
		{
			System.Collections.ArrayList exList = new System.Collections.ArrayList();
			for (int i = 1; i <= segment.numFields(); i++)
			{
				if (!allowedFields.Contains((System.Int32) i))
				{
					try
					{
						Genetibase.NuGenHL7.model.Type[] reps = segment.getField(i);
						for (int j = 0; j < reps.Length; j++)
						{
							if (hasContent(reps[j]))
							{
								NuGenHL7Exception e = new NuGenXElementPresentException("Field " + i + " in " + segment.getName() + " appears in the message but not in the profile");
								exList.Add(e);
							}
						}
					}
					catch (NuGenHL7Exception he)
					{
						throw new NuGenProfileException("Problem testing against profile", he);
					}
				}
			}
			return this.toArray(exList);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:34,代码来源:NuGenDefaultValidator.cs


注:本文中的Segment.numFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。