コード例 #1
0
        private bool IsTheSame(Enumeration comparisonEnum, ComparisonDepth depth)
        {
            if (comparisonEnum == null)
            {
                return(false);
            }

            if (Name == comparisonEnum.Name)
            {
                if ((ParentObject == null && comparisonEnum.ParentObject == null) ||
                    (ParentObject.GetType() == comparisonEnum.ParentObject.GetType() &&
                     ParentObject.Name == comparisonEnum.ParentObject.Name))
                {
                    if (depth == ComparisonDepth.Signature)
                    {
                        return(true);
                    }

                    if (!base.IsTheSame(comparisonEnum, depth))
                    {
                        return(false);
                    }

                    if (!Utility.StringCollectionsAreTheSame(Modifiers, comparisonEnum.Modifiers))
                    {
                        ComparisonDifference += GetType().Name + ".Modifiers";
                        return(false);
                    }

                    if (depth == ComparisonDepth.Outer)
                    {
                        return(true);
                    }

                    // Now check all child objects
                    Comparers.BaseConstructComparer comparer = new Comparers.BaseConstructComparer();

                    if (EnumBase != comparisonEnum.EnumBase)
                    {
                        return(false);
                    }
                    if (!ArchAngel.Providers.CodeProvider.CSharp.Utility.BaseContructCollectionsAreTheSame(Members.ToArray(), comparisonEnum.Members.ToArray(), comparer))
                    {
                        ComparisonDifference += GetType().Name + ".Members";
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
            private bool IsTheSame(EnumMember comparisonEnumMember, ComparisonDepth depth)
            {
                if (Name == comparisonEnumMember.Name)
                {
                    if ((ParentObject == null && comparisonEnumMember.ParentObject == null) ||
                        (ParentObject.GetType() == comparisonEnumMember.ParentObject.GetType() &&
                         ParentObject.Name == comparisonEnumMember.ParentObject.Name))
                    {
                        if (depth == ComparisonDepth.Signature)
                        {
                            return(true);
                        }

                        if (!base.IsTheSame(comparisonEnumMember, depth))
                        {
                            return(false);
                        }
                        return(true);
                    }
                }
                return(false);
            }
コード例 #3
0
        private bool IsTheSame(Struct comparisonStruct, ComparisonDepth depth)
        {
            if (comparisonStruct == null)
            {
                return(false);
            }

            if (Name == comparisonStruct.Name)
            {
                // Function names are the same, so now compare the class names
                //Class thisParentClass = (Class)this.ParentObject;
                //Class comparisonParentClass = (Class)comparisonStruct.ParentObject;

                //if (thisParentClass.IsTheSame(comparisonParentClass))
                if ((ParentObject == null && comparisonStruct.ParentObject == null) ||
                    (ParentObject.GetType() == comparisonStruct.ParentObject.GetType() &&
                     ParentObject.Name == comparisonStruct.ParentObject.Name))
                {
                    if (depth == ComparisonDepth.Signature)
                    {
                        return(true);
                    }

                    if (!base.IsTheSame(comparisonStruct, depth))
                    {
                        return(false);
                    }
                    if (!Utility.StringCollectionsAreTheSame(Modifiers, comparisonStruct.Modifiers))
                    {
                        ComparisonDifference += GetType().Name + ".Modifiers";
                        return(false);
                    }

                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
        private void Invariants()
        {
            Contract.Invariant
            (
                ParentObject != null
                &&
                (
                    ParentObjectProperty == null
                    ||
                    (
                        ParentObjectProperty != null &&
                        ParentObjectProperty.DeclaringType == ParentObject.GetType()
                    )
                ),
                "An object which declares that has a parent object must provide a non-null reference to the whole parent object"
            );

            Contract.Invariant
            (
                ParentObjectProperty != null &&
                ParentObjectProperty.DeclaringType == ParentObject.GetType(),
                "An object which declares that has a parent object must provide a non-null reference to the property which holds the parent object"
            );
        }