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


C# Path.NextStep方法代码示例

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


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

示例1: ToLogicalPath

        /// <summary>
        /// Convert physicalPath to a logical path
        /// </summary>
        /// <param name="aLanguage"></param>
        /// <param name="physicalPath"></param>
        /// <returns></returns>
        private string ToLogicalPath(string aLanguage, string physicalPath)
        {
            Path pathProcessor = new Path(physicalPath);
            string logicalPath = null;
            do
            {
                logicalPath += "/" + pathProcessor.CurrentAttribute;

                if (pathProcessor.IsCurrentIdentified)
                {
                    ArchetypeTerm archetypeTerm = this.Ontology.TermDefinition(aLanguage, pathProcessor.CurrentNodeId);
                    string name = archetypeTerm.Items.Item("text");
                    if (string.IsNullOrEmpty(name))
                        throw new ApplicationException(string.Format(CommonStrings.XIsNullOrEmpty, name));
                    logicalPath += "[" + name + "]";
                }
            } while (pathProcessor.NextStep());

            Check.Ensure(!string.IsNullOrEmpty(logicalPath), "logicalPath must not be null or empty.");

            return logicalPath;
        }
开发者ID:nickvane,项目名称:OpenEHR,代码行数:28,代码来源:Archetype.cs

示例2: BuildPath

        protected void BuildPath(Path path)
        {
            Check.Require(path != null, "path must not be null");
            Check.Require(path.Current != null, "current path step must not be null");

            string attributeName = path.Current.Attribute;

            object value = GetAttributeValue(attributeName);
            if (value == null)
            {
                CComplexObject complexObjectConstraint = this.Constraint as CComplexObject;
                if (complexObjectConstraint == null)
                    throw new NotImplementedException();

                CAttribute attributeConstraint = complexObjectConstraint.GetAttribute(attributeName);
                if (attributeConstraint == null)
                    throw new ApplicationException("constraint for attribute not found");

                CMultipleAttribute multipleAttributeConstraint = attributeConstraint as CMultipleAttribute;

                if (multipleAttributeConstraint == null)
                {
                    if (attributeConstraint.Children.Count != 1)
                        throw new ApplicationException("Single attribute constraint must have exactly one children");

                    CObject objectConstraint = attributeConstraint.Children[0];
                    CDefinedObject definedObjectConstraint = objectConstraint as CDefinedObject;
                    if (definedObjectConstraint == null)
                        throw new NotImplementedException();

                    value = definedObjectConstraint.DefaultValue;
                    SetAttributeValue(attributeName, value);

                }
                else
                {
                    Type itemType = null;
                    value = multipleAttributeConstraint.CreateAggregate(itemType);
                    SetAttributeValue(attributeName, value);
                }
            }

            if (path.NextStep())
            {
                IRmType rmType = value as IRmType;
                if (rmType == null)
                {
                    AssumedTypes.IAggregate container = value as AssumedTypes.IAggregate;
                    if (container != null)
                        container.BuildPath(path);
                    else
                        throw new ApplicationException("expected IRmType");
                }
                else
                    rmType.BuildPath(path);
            }
        }
开发者ID:nickvane,项目名称:OpenEHR,代码行数:57,代码来源:RmType.cs

示例3: GetCObjectAtTargetPath

        /// <summary>
        /// an internal static method returning the targetPath corresponding CObject.
        /// Returns null if the targetPath doesn't have any associated CObject
        /// </summary>
        /// <param name="archetypeDefinition"></param>
        /// <param name="targetPath"></param>
        /// <returns></returns>
        internal static CObject GetCObjectAtTargetPath(CComplexObject archetypeDefinition, string targetPath)
        {
            CComplexObject cObj = archetypeDefinition;
            CAttribute attribute = null;

            Path pathProcessor = new Path(targetPath);

            do
            {
                foreach (CAttribute cAttri in cObj.Attributes)
                {
                    if (cAttri.RmAttributeName == pathProcessor.CurrentAttribute)
                    {
                        attribute = cAttri;
                        break;
                    }
                }

                Check.Assert(attribute != null, string.Format(CommonStrings.XMustNotBeNull, "attribute"));

                if (attribute.RmAttributeName != pathProcessor.CurrentAttribute)
                    return null;

                foreach (CObject obj in attribute.Children)
                {
                    if (obj.NodeId == pathProcessor.CurrentNodeId)
                    {
                        cObj = obj as CComplexObject;
                        break;
                    }
                }

                Check.Assert(cObj != null, string.Format(CommonStrings.XMustNotBeNull, "cObj"));

                if (cObj.NodeId != pathProcessor.CurrentNodeId)
                    return null;

            } while (pathProcessor.NextStep());

            Check.Ensure(cObj.Path == targetPath, "cObj.Path must be the same as this.TargetPath");

            return cObj;
        }
开发者ID:nickvane,项目名称:OpenEHR,代码行数:50,代码来源:Archetype.cs


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