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


C# Generated.getPreConditions方法代码示例

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


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

示例1: compareCase

        /// <summary>
        /// Compares two Case and annotates the differences on the first one
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="other"></param>
        public static void compareCase(Generated.Case obj, Generated.Case 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.allPreConditions() != null )
            {
                if ( other.allPreConditions() != null )
                {
                    int i = 0;
                    while ( i < obj.countPreConditions() && i < other.countPreConditions() )
                    {
                        Generated.PreCondition element = obj.getPreConditions( i );
                        Generated.PreCondition otherElement = other.getPreConditions( i );
                        comparePreCondition ( element, otherElement, diff );
                        i += 1;
                    }
                    while ( i < obj.countPreConditions() )
                    {
                        diff.appendChanges ( new Diff(obj.getPreConditions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", obj.getPreConditions( i ).Name ) );
                        i += 1;
                    }
                    while ( i < other.countPreConditions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "PreConditions", other.getPreConditions( i ).Name) );
                        i += 1;
                    }
                }
                else
                {
                    foreach ( Generated.PreCondition subElement in obj.allPreConditions() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allPreConditions() != null )
                {
                    foreach ( Generated.PreCondition otherElement in other.allPreConditions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "PreConditions", otherElement.Name) );
                    }
                }
            }
            if ( !CompareUtil.canonicalStringEquality(obj.getExpression(), other.getExpression()) )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Expression", other.getExpression(), obj.getExpression()) );
            }
            if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) )
            {
                diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) );
            }
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:65,代码来源:Comparer.cs

示例2: ensureGuidCase

        /// <summary>
        /// Ensures that two Case 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 ensureGuidCase(Generated.Case obj, Generated.Case 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.allPreConditions() != null )
            {
                if ( other.allPreConditions() != null )
                {
                    int i = 0;
                    while ( i < obj.countPreConditions() && i < other.countPreConditions() )
                    {
                        Generated.PreCondition element = obj.getPreConditions( i );
                        Generated.PreCondition otherElement = other.getPreConditions( i );
                        ensureGuidPreCondition ( element, otherElement );
                        i += 1;
                    }
                    while ( i < obj.countPreConditions() )
                    {
                        Generated.PreCondition element = obj.getPreConditions( i );
                        ensureGuidPreCondition ( element, null );
                        i += 1;
                    }
                    while ( i < other.countPreConditions() )
                    {
                        Generated.PreCondition otherElement = other.getPreConditions( i );
                        ensureGuidPreCondition ( null, otherElement );
                        i += 1;
                    }
                }
                else
                {
                    foreach ( Generated.PreCondition subElement in obj.allPreConditions() )
                    {
                        ensureGuidPreCondition ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allPreConditions() != null )
                {
                    foreach ( Generated.PreCondition otherElement in other.allPreConditions() )
                    {
                        ensureGuidPreCondition ( null, otherElement );
                    }
                }
            }
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:90,代码来源:Comparer.cs

示例3: compareRuleCondition

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

            compareReqRelated (obj, other, diff);

            if ( obj.allPreConditions() != null )
            {
                if ( other.allPreConditions() != null )
                {
                    int i = 0;
                    while ( i < obj.countPreConditions() && i < other.countPreConditions() )
                    {
                        Generated.PreCondition element = obj.getPreConditions( i );
                        Generated.PreCondition otherElement = other.getPreConditions( i );
                        comparePreCondition ( element, otherElement, diff );
                        i += 1;
                    }
                    while ( i < obj.countPreConditions() )
                    {
                        diff.appendChanges ( new Diff(obj.getPreConditions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", obj.getPreConditions( i ).Name ) );
                        i += 1;
                    }
                    while ( i < other.countPreConditions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "PreConditions", other.getPreConditions( i ).Name) );
                        i += 1;
                    }
                }
                else
                {
                    foreach ( Generated.PreCondition subElement in obj.allPreConditions() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allPreConditions() != null )
                {
                    foreach ( Generated.PreCondition otherElement in other.allPreConditions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "PreConditions", otherElement.Name) );
                    }
                }
            }
            if ( obj.allActions() != null )
            {
                if ( other.allActions() != null )
                {
                    int i = 0;
                    while ( i < obj.countActions() && i < other.countActions() )
                    {
                        Generated.Action element = obj.getActions( i );
                        Generated.Action otherElement = other.getActions( i );
                        compareAction ( element, otherElement, diff );
                        i += 1;
                    }
                    while ( i < obj.countActions() )
                    {
                        diff.appendChanges ( new Diff(obj.getActions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Actions", "", obj.getActions( i ).Name ) );
                        i += 1;
                    }
                    while ( i < other.countActions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "Actions", other.getActions( i ).Name) );
                        i += 1;
                    }
                }
                else
                {
                    foreach ( Generated.Action subElement in obj.allActions() )
                    {
                        diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Actions", "", subElement.Name ) );
                    }
                }
            }
            else
            {
                if ( other.allActions() != null )
                {
                    foreach ( Generated.Action otherElement in other.allActions() )
                    {
                        diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Actions", otherElement.Name) );
                    }
                }
            }
            if ( obj.allSubRules() != null )
            {
                if ( other.allSubRules() != null )
//.........这里部分代码省略.........
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:101,代码来源:Comparer.cs

示例4: ensureGuidRuleCondition

        /// <summary>
        /// Ensures that two RuleCondition 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 ensureGuidRuleCondition(Generated.RuleCondition obj, Generated.RuleCondition 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;
                }
            }

            ensureGuidReqRelated (obj, other);

            if ( obj.allPreConditions() != null )
            {
                if ( other.allPreConditions() != null )
                {
                    int i = 0;
                    while ( i < obj.countPreConditions() && i < other.countPreConditions() )
                    {
                        Generated.PreCondition element = obj.getPreConditions( i );
                        Generated.PreCondition otherElement = other.getPreConditions( i );
                        ensureGuidPreCondition ( element, otherElement );
                        i += 1;
                    }
                    while ( i < obj.countPreConditions() )
                    {
                        Generated.PreCondition element = obj.getPreConditions( i );
                        ensureGuidPreCondition ( element, null );
                        i += 1;
                    }
                    while ( i < other.countPreConditions() )
                    {
                        Generated.PreCondition otherElement = other.getPreConditions( i );
                        ensureGuidPreCondition ( null, otherElement );
                        i += 1;
                    }
                }
                else
                {
                    foreach ( Generated.PreCondition subElement in obj.allPreConditions() )
                    {
                        ensureGuidPreCondition ( subElement, null );
                    }
                }
            }
            else
            {
                if ( other.allPreConditions() != null )
                {
                    foreach ( Generated.PreCondition otherElement in other.allPreConditions() )
                    {
                        ensureGuidPreCondition ( null, otherElement );
                    }
                }
            }
            if ( obj.allActions() != null )
            {
                if ( other.allActions() != null )
                {
                    int i = 0;
                    while ( i < obj.countActions() && i < other.countActions() )
                    {
                        Generated.Action element = obj.getActions( i );
                        Generated.Action otherElement = other.getActions( i );
                        ensureGuidAction ( element, otherElement );
                        i += 1;
//.........这里部分代码省略.........
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:101,代码来源:Comparer.cs


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