コード例 #1
0
        protected bool EqualsPUI(CUDResultDiff cudResultDiff, IPrimitiveUpdateItem left, IPrimitiveUpdateItem right)
        {
            if (Object.Equals(left.NewValue, right.NewValue))
            {
                return(true);
            }
            if (!cudResultDiff.doFullDiff)
            {
                return(false);
            }
            CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();

            containerBuild.AddPrimitive(right);
            return(false);
        }
コード例 #2
0
        protected bool EqualsRUIs(CUDResultDiff cudResultDiff, IRelationUpdateItem[] left, IRelationUpdateItem[] right)
        {
            if (left == null || left.Length == 0)
            {
                if (right == null || right.Length == 0)
                {
                    return(true);
                }
                if (cudResultDiff.doFullDiff)
                {
                    CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();
                    foreach (IRelationUpdateItem rightRui in right)
                    {
                        containerBuild.AddRelation(rightRui);
                    }
                }
                return(false);
            }
            if (right == null || right.Length == 0)
            {
                throw new Exception("Must never happen");
            }
            if (left.Length != right.Length)
            {
                if (!cudResultDiff.doFullDiff)
                {
                    return(false);
                }
                int leftIndex = left.Length - 1;
                for (int rightIndex = right.Length; rightIndex-- > 0;)
                {
                    IRelationUpdateItem leftRui  = leftIndex >= 0 ? left[leftIndex] : null;
                    IRelationUpdateItem rightRui = right[rightIndex];
                    if (leftRui == null || !leftRui.MemberName.Equals(rightRui.MemberName))
                    {
                        CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();
                        containerBuild.AddRelation(rightRui);
                        continue;
                    }
                    if (!EqualsRUI(cudResultDiff, leftRui, rightRui))
                    {
                        if (!cudResultDiff.doFullDiff)
                        {
                            return(false);
                        }
                    }
                    leftIndex--;
                }
                return(false);
            }
            bool isEqual = true;

            for (int a = left.Length; a-- > 0;)
            {
                IRelationUpdateItem rightPui = right[a];
                if (!EqualsRUI(cudResultDiff, left[a], rightPui))
                {
                    if (!cudResultDiff.doFullDiff)
                    {
                        return(false);
                    }
                    isEqual = false;
                }
            }
            return(isEqual);
        }