Exemple #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);
        }
Exemple #2
0
        protected bool EqualsPUIs(CUDResultDiff cudResultDiff, IPrimitiveUpdateItem[] left, IPrimitiveUpdateItem[] right)
        {
            if (left == null || left.Length == 0)
            {
                if (right == null || right.Length == 0)
                {
                    return(true);
                }
                if (!cudResultDiff.doFullDiff)
                {
                    return(false);
                }
                CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();
                foreach (IPrimitiveUpdateItem rightPui in right)
                {
                    containerBuild.AddPrimitive(rightPui);
                }
                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;)
                {
                    IPrimitiveUpdateItem leftPui  = leftIndex >= 0 ? left[leftIndex] : null;
                    IPrimitiveUpdateItem rightPui = right[rightIndex];
                    if (leftPui == null || !leftPui.MemberName.Equals(rightPui.MemberName))
                    {
                        CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();
                        containerBuild.AddPrimitive(rightPui);
                        continue;
                    }
                    if (!EqualsPUI(cudResultDiff, leftPui, rightPui))
                    {
                        if (!cudResultDiff.doFullDiff)
                        {
                            return(false);
                        }
                        CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();
                        containerBuild.AddPrimitive(rightPui);
                    }
                    leftIndex--;
                }
                return(false);
            }
            bool isEqual = true;

            for (int a = left.Length; a-- > 0;)
            {
                IPrimitiveUpdateItem rightPui = right[a];
                if (!EqualsPUI(cudResultDiff, left[a], rightPui))
                {
                    if (!cudResultDiff.doFullDiff)
                    {
                        return(false);
                    }
                    CreateOrUpdateContainerBuild containerBuild = cudResultDiff.UpdateContainerBuild();
                    containerBuild.AddPrimitive(rightPui);
                    isEqual = false;
                }
            }
            return(isEqual);
        }