本文整理汇总了C#中Group.getAll方法的典型用法代码示例。如果您正苦于以下问题:C# Group.getAll方法的具体用法?C# Group.getAll怎么用?C# Group.getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group.getAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkForExtraStructures
/// <summary> Checks a group's children against a list of allowed structures for the group
/// (ie those mentioned in the profile with usage other than X). Returns
/// a list of exceptions representing structures that appear in the message
/// but are not supposed to.
/// </summary>
private NuGenHL7Exception[] checkForExtraStructures(Group group, System.Collections.ArrayList allowedStructures)
{
System.Collections.ArrayList exList = new System.Collections.ArrayList();
System.String[] childNames = group.Names;
for (int i = 0; i < childNames.Length; i++)
{
if (!allowedStructures.Contains(childNames[i]))
{
try
{
Structure[] reps = group.getAll(childNames[i]);
for (int j = 0; j < reps.Length; j++)
{
if (hasContent(reps[j]))
{
NuGenHL7Exception e = new NuGenXElementPresentException("The structure " + childNames[i] + " appears in the message but not in the profile");
exList.Add(e);
}
}
}
catch (NuGenHL7Exception he)
{
throw new NuGenProfileException("Problem checking profile", he);
}
}
}
return toArray(exList);
}
示例2: testGroup
/// <summary> Tests a group against a group section of a profile.</summary>
public virtual NuGenHL7Exception[] testGroup(Group group, AbstractSegmentContainer profile, System.String profileID)
{
System.Collections.ArrayList exList = new System.Collections.ArrayList(20);
System.Collections.ArrayList allowedStructures = new System.Collections.ArrayList(20);
for (int i = 1; i <= profile.Children; i++)
{
ProfileStructure struct_Renamed = profile.getChild(i);
//only test a structure in detail if it isn't X
if (!struct_Renamed.Usage.ToUpper().Equals("X".ToUpper()))
{
allowedStructures.Add(struct_Renamed.Name);
//see which instances have content
try
{
Structure[] instances = group.getAll(struct_Renamed.Name);
System.Collections.ArrayList instancesWithContent = new System.Collections.ArrayList(10);
for (int j = 0; j < instances.Length; j++)
{
if (hasContent(instances[j]))
instancesWithContent.Add(instances[j]);
}
NuGenHL7Exception ce = testCardinality(instancesWithContent.Count, struct_Renamed.Min, struct_Renamed.Max, struct_Renamed.Usage, struct_Renamed.Name);
if (ce != null)
exList.Add(ce);
//test children on instances with content
for (int j = 0; j < instancesWithContent.Count; j++)
{
Structure s = (Structure) instancesWithContent[j];
NuGenHL7Exception[] childExceptions = testStructure(s, struct_Renamed, profileID);
addToList(childExceptions, exList);
}
}
catch (NuGenHL7Exception)
{
exList.Add(new NuGenProfileNotHL7CompliantException(struct_Renamed.Name + " not found in message"));
}
}
}
//complain about X structures that have content
addToList(checkForExtraStructures(group, allowedStructures), exList);
return toArray(exList);
}
示例3: 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;
}