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


C# Structure.getStructureName方法代码示例

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


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

示例1: getIndex

        /// <summary> Returns the index of the given structure as a child of the 
        /// given parent.  Returns null if the child isn't found. 
        /// </summary>
        public static Index getIndex(Group parent, Structure child)
        {
            Index index = null;
            System.String[] names = parent.Names;
            for (int i = 0; i < names.Length; i++)
            {
                if (names[i].StartsWith(child.getStructureName()))
                {
                    try
                    {
                        Structure[] reps = parent.getAll(names[i]);
                        for (int j = 0; j < reps.Length; j++)
                        {
                            if (child == reps[j])
                            {
                                index = new Index(names[i], j);
                                //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1012'"
                                goto findChild_brk;
                            }
                        }
                    }
                    catch (HL7Exception e)
                    {
                        log.error("", e);
                        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                        throw new System.ApplicationException("Internal HL7Exception finding structure index: " + e.Message);
                    }
                }
            }
            //UPGRADE_NOTE: Label 'findChild_brk' was added. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1011'"

            findChild_brk: ;

            return index;
        }
开发者ID:snosrap,项目名称:nhapi,代码行数:38,代码来源:MessageIterator.cs

示例2: contains

 /// <summary> Determines whether the given structure matches the given name, or contains 
 /// a child that does.  
 /// </summary>
 /// <param name="s">the structure to check 
 /// </param>
 /// <param name="name">the name to look for 
 /// </param>
 /// <param name="firstDescendentsOnly">only checks first descendents (i.e. first 
 /// child, first child of first child, etc.)  In theory the first child 
 /// of a group should always be present, and we don't use this method with 
 /// subsequent children because finding the next position within a group is 
 /// straightforward.  
 /// </param>
 /// <param name="upToFirstRequired">only checks first descendents and of their siblings 
 /// up to the first required one.  This may be needed because in practice 
 /// some first children of groups are not required.  
 /// </param>
 public static bool contains(Structure s, System.String name, bool firstDescendentsOnly, bool upToFirstRequired)
 {
     bool contains = false;
     if (typeof(Segment).IsAssignableFrom(s.GetType()))
     {
         if (s.getStructureName().Equals(name))
             contains = true;
     }
     else
     {
         Group g = (Group) s;
         System.String[] names = g.Names;
         for (int i = 0; i < names.Length && !contains; i++)
         {
             try
             {
                 contains = MessageIterator.contains(g.get_Renamed(names[i], 0), name, firstDescendentsOnly, upToFirstRequired);
                 if (firstDescendentsOnly)
                     break;
                 if (upToFirstRequired && g.isRequired(names[i]))
                     break;
             }
             catch (HL7Exception e)
             {
                 //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                 throw new System.ApplicationException("HL7Exception due to bad index: " + e.Message);
             }
         }
     }
     return contains;
 }
开发者ID:snosrap,项目名称:nhapi,代码行数:48,代码来源:MessageIterator.cs


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