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


C# Generated.allFolders方法代码示例

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


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

示例1: ensureGuidFolder

        /// <summary>
        /// Ensures that two Folder have matching GUID, and recursively.
        /// obj is the leader for Guid. If other doesn't match obj guid, 
        ///   1. other does not have a guid, in that case, other should have the same guid as obj
        ///   2. other already has a guid. In that case, there is a mismatch between objects, and the process stops here
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void ensureGuidFolder(Generated.Folder obj, Generated.Folder other)
        {
            if ( obj == null )
            {
                if ( other != null )
                {
                    // Side effect, setup a GUID if needed for the other part (other)
                    string guid = other.Guid;
                }
                return;
            }

            if ( other == null )
            {
                if ( obj != null )
                {
                    // Side effect, setup a GUID if needed for the other part (obj)
                    string guid = obj.Guid;
                }
                return;
            }

            if ( obj.Guid != other.getGuid() )
            {
                if ( string.IsNullOrEmpty(other.getGuid()) || GuidByName && (obj.Name == other.Name) )
                {
                    // These are matching elements, copy the guid from  obj
                    other.setGuid ( obj.Guid );
                }
                else
                {
                    // Elements do not match. Stop the recursive process
                    return;
                }
            }

            ensureGuidNamable (obj, other);

            if ( obj.allFolders() != null )
            {
                if ( other.allFolders() != null )
                {
                    foreach ( Generated.Folder subElement in obj.allFolders() )
                    {
                        bool found = false;

                        // Try first to assign Guid to elements which do not have a guid
                        // This helps handling duplicated in lists
                        foreach ( Generated.Folder otherElement in other.allFolders() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
                            {
                                ensureGuidFolder ( subElement, otherElement );
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            foreach ( Generated.Folder otherElement in other.allFolders() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidFolder ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidFolder ( subElement, null );
                        }
                    }

                    foreach ( Generated.Folder otherElement in other.allFolders() )
                    {
                        bool found = false;
                        foreach ( Generated.Folder subElement in obj.allFolders() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidFolder ( null, otherElement );
//.........这里部分代码省略.........
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:101,代码来源:Comparer.cs

示例2: searchTranslationDictionary

        /// <summary>
        /// Searches a specific string in TranslationDictionary and updates the list 
        /// of model element with all the elements in which that string is found
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="obj">The string to search for</param>
        /// <param name="occurences">The list of model elements which hold the searched string</param>
        public static void searchTranslationDictionary(Generated.TranslationDictionary obj, string searchString, List<ModelElement> occurences)
        {
            searchNamable (obj, searchString, occurences);

            if ( obj.allFolders() != null )
            {
                foreach ( Generated.Folder subElement in obj.allFolders() )
                {
                    searchFolder ( subElement, searchString, occurences );
                }
            }
            if ( obj.allTranslations() != null )
            {
                foreach ( Generated.Translation subElement in obj.allTranslations() )
                {
                    searchTranslation ( subElement, searchString, occurences );
                }
            }
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:26,代码来源:Comparer.cs

示例3: compareTranslationDictionary

        /// <summary>
        /// Compares two TranslationDictionary and annotates the differences on the first one
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void compareTranslationDictionary(Generated.TranslationDictionary obj, Generated.TranslationDictionary other, VersionDiff diff)
        {
            if ( other == null )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
                return;
            }

            compareNamable (obj, other, diff);

            if ( obj.allFolders() != null )
            {
                if ( other.allFolders() != null )
                {
                    foreach ( Generated.Folder subElement in obj.allFolders() )
                    {
                        bool compared = false;
                        foreach ( Generated.Folder otherElement in other.allFolders() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareFolder ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Folders", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Folder otherElement in other.allFolders() )
                    {
                        bool found = false;
                        foreach ( Generated.Folder subElement in obj.allFolders() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Folders", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.Folder subElement in obj.allFolders() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Folders", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allFolders() != null )
                {
                    foreach ( Generated.Folder otherElement in other.allFolders() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Folders", otherElement.Name) );
                    }
                }
            }
            if ( obj.allTranslations() != null )
            {
                if ( other.allTranslations() != null )
                {
                    foreach ( Generated.Translation subElement in obj.allTranslations() )
                    {
                        bool compared = false;
                        foreach ( Generated.Translation otherElement in other.allTranslations() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareTranslation ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

                        if ( !compared )
                        {
                            diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Translations", "", subElement.Name ) );
                        }
                    }

                    foreach ( Generated.Translation otherElement in other.allTranslations() )
                    {
                        bool found = false;
//.........这里部分代码省略.........
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:101,代码来源:Comparer.cs

示例4: searchShortcutFolder

        /// <summary>
        /// Searches a specific string in ShortcutFolder and updates the list 
        /// of model element with all the elements in which that string is found
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="obj">The string to search for</param>
        /// <param name="occurences">The list of model elements which hold the searched string</param>
        public static void searchShortcutFolder(Generated.ShortcutFolder obj, string searchString, List<ModelElement> occurences)
        {
            searchNamable (obj, searchString, occurences);

            if ( obj.allFolders() != null )
            {
                foreach ( Generated.ShortcutFolder subElement in obj.allFolders() )
                {
                    searchShortcutFolder ( subElement, searchString, occurences );
                }
            }
            if ( obj.allShortcuts() != null )
            {
                foreach ( Generated.Shortcut subElement in obj.allShortcuts() )
                {
                    searchShortcut ( subElement, searchString, occurences );
                }
            }
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:26,代码来源:Comparer.cs


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