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


C# Generated.allNameSpaces方法代码示例

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


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

示例1: ensureGuidNameSpace

        /// <summary>
        /// Ensures that two NameSpace 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 ensureGuidNameSpace(Generated.NameSpace obj, Generated.NameSpace 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.allNameSpaces() != null )
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        bool found = false;

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

                        if ( !found )
                        {
                            foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidNameSpace ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }

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

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

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

示例2: ensureGuidDictionary


//.........这里部分代码省略.........
                        foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() )
                        {
                            if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            ensureGuidRuleDisabling ( null, otherElement );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() )
                    {
                        ensureGuidRuleDisabling ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allRuleDisablings() != null )
                {
                    foreach ( Generated.RuleDisabling otherElement in other.allRuleDisablings() )
                    {
                        ensureGuidRuleDisabling ( null, otherElement );
                    }
                }
            }
            if ( obj.allNameSpaces() != null )
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        bool found = false;

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

                        if ( !found )
                        {
                            foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                            {
                                if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
                                {
                                    ensureGuidNameSpace ( subElement, otherElement );
                                    found = true;
                                    break;
                                }
                            }
                        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:66,代码来源:Comparer.cs

示例3: compareDictionary


//.........这里部分代码省略.........
                        foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
                        }

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RuleDisablings", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RuleDisablings", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allRuleDisablings() != null )
                {
                    foreach ( Generated.RuleDisabling otherElement in other.allRuleDisablings() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RuleDisablings", otherElement.Name) );
                    }
                }
            }
            if ( obj.allNameSpaces() != null )
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        bool compared = false;
                        foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareNameSpace ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

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

                    foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                    {
                        bool found = false;
                        foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                found = true;
                                break;
                            }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:67,代码来源:Comparer.cs

示例4: compareNameSpace

        /// <summary>
        /// Compares two NameSpace and annotates the differences on the first one
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void compareNameSpace(Generated.NameSpace obj, Generated.NameSpace 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.allNameSpaces() != null )
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        bool compared = false;
                        foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareNameSpace ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

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

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

                        if ( !found )
                        {
                            diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaces", otherElement.Name) );
                        }
                    }
                }
                else
                {
                    foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaces", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allNameSpaces() != null )
                {
                    foreach ( Generated.NameSpace otherElement in other.allNameSpaces() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaces", otherElement.Name) );
                    }
                }
            }
            if ( obj.allNameSpaceRefs() != null )
            {
                if ( other.allNameSpaceRefs() != null )
                {
                    foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                    {
                        bool compared = false;
                        foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() )
                        {
                            if ( subElement.Guid == otherElement.Guid )
                            {
                                compareNameSpaceRef ( subElement, otherElement, diff );
                                compared = true;
                            break;
                            }
                        }

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

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

示例5: searchNameSpace

        /// <summary>
        /// Searches a specific string in NameSpace 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 searchNameSpace(Generated.NameSpace obj, string searchString, List<ModelElement> occurences)
        {
            searchNamable (obj, searchString, occurences);

            if ( obj.allNameSpaces() != null )
            {
                foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
                {
                    searchNameSpace ( subElement, searchString, occurences );
                }
            }
            if ( obj.allNameSpaceRefs() != null )
            {
                foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
                {
                    searchNameSpaceRef ( subElement, searchString, occurences );
                }
            }
            if ( obj.allRanges() != null )
            {
                foreach ( Generated.Range subElement in obj.allRanges() )
                {
                    searchRange ( subElement, searchString, occurences );
                }
            }
            if ( obj.allEnumerations() != null )
            {
                foreach ( Generated.Enum subElement in obj.allEnumerations() )
                {
                    searchEnum ( subElement, searchString, occurences );
                }
            }
            if ( obj.allStructures() != null )
            {
                foreach ( Generated.Structure subElement in obj.allStructures() )
                {
                    searchStructure ( subElement, searchString, occurences );
                }
            }
            if ( obj.allCollections() != null )
            {
                foreach ( Generated.Collection subElement in obj.allCollections() )
                {
                    searchCollection ( subElement, searchString, occurences );
                }
            }
            if ( obj.allStateMachines() != null )
            {
                foreach ( Generated.StateMachine subElement in obj.allStateMachines() )
                {
                    searchStateMachine ( subElement, searchString, occurences );
                }
            }
            if ( obj.allFunctions() != null )
            {
                foreach ( Generated.Function subElement in obj.allFunctions() )
                {
                    searchFunction ( subElement, searchString, occurences );
                }
            }
            if ( obj.allProcedures() != null )
            {
                foreach ( Generated.Procedure subElement in obj.allProcedures() )
                {
                    searchProcedure ( subElement, searchString, occurences );
                }
            }
            if ( obj.allVariables() != null )
            {
                foreach ( Generated.Variable subElement in obj.allVariables() )
                {
                    searchVariable ( subElement, searchString, occurences );
                }
            }
            if ( obj.allRules() != null )
            {
                foreach ( Generated.Rule subElement in obj.allRules() )
                {
                    searchRule ( subElement, searchString, occurences );
                }
            }
            if ( obj.getComment() != null && obj.getComment().Contains (searchString) )
            {
                occurences.Add ( obj );
            }
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:93,代码来源:Comparer.cs

示例6: searchDictionary

 /// <summary>
 /// Searches a specific string in Dictionary 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 searchDictionary(Generated.Dictionary obj, string searchString, List<ModelElement> occurences)
 {
     if ( obj.allSpecifications() != null )
     {
         foreach ( Generated.Specification subElement in obj.allSpecifications() )
         {
             searchSpecification ( subElement, searchString, occurences );
         }
     }
     if ( obj.allRequirementSets() != null )
     {
         foreach ( Generated.RequirementSet subElement in obj.allRequirementSets() )
         {
             searchRequirementSet ( subElement, searchString, occurences );
         }
     }
     if ( obj.allRuleDisablings() != null )
     {
         foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() )
         {
             searchRuleDisabling ( subElement, searchString, occurences );
         }
     }
     if ( obj.allNameSpaces() != null )
     {
         foreach ( Generated.NameSpace subElement in obj.allNameSpaces() )
         {
             searchNameSpace ( subElement, searchString, occurences );
         }
     }
     if ( obj.allNameSpaceRefs() != null )
     {
         foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() )
         {
             searchNameSpaceRef ( subElement, searchString, occurences );
         }
     }
     if ( obj.allTests() != null )
     {
         foreach ( Generated.Frame subElement in obj.allTests() )
         {
             searchFrame ( subElement, searchString, occurences );
         }
     }
     if ( obj.allTestRefs() != null )
     {
         foreach ( Generated.FrameRef subElement in obj.allTestRefs() )
         {
             searchFrameRef ( subElement, searchString, occurences );
         }
     }
     if ( obj.getTranslationDictionary() != null )
     {
         searchTranslationDictionary ( obj.getTranslationDictionary(), searchString, occurences );
     }
     if ( obj.getShortcutDictionary() != null )
     {
         searchShortcutDictionary ( obj.getShortcutDictionary(), searchString, occurences );
     }
     if ( obj.getXsi() != null && obj.getXsi().Contains (searchString) )
     {
         occurences.Add ( obj );
     }
     if ( obj.getXsiLocation() != null && obj.getXsiLocation().Contains (searchString) )
     {
         occurences.Add ( obj );
     }
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:75,代码来源:Comparer.cs


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