Given an array of patches, return another array that is identical. @param patches Array of Patch objects. @return Array of Patch objects.
(LinkedList<Patch> patches)
| 1932 | * @return Array of Patch objects. |
| 1933 | */ |
| 1934 | public LinkedList<Patch> patch_deepCopy(LinkedList<Patch> patches) { |
| 1935 | LinkedList<Patch> patchesCopy = new LinkedList<Patch>(); |
| 1936 | for (Patch aPatch : patches) { |
| 1937 | Patch patchCopy = new Patch(); |
| 1938 | for (Diff aDiff : aPatch.diffs) { |
| 1939 | Diff diffCopy = new Diff(aDiff.operation, aDiff.text); |
| 1940 | patchCopy.diffs.add(diffCopy); |
| 1941 | } |
| 1942 | patchCopy.start1 = aPatch.start1; |
| 1943 | patchCopy.start2 = aPatch.start2; |
| 1944 | patchCopy.length1 = aPatch.length1; |
| 1945 | patchCopy.length2 = aPatch.length2; |
| 1946 | patchesCopy.add(patchCopy); |
| 1947 | } |
| 1948 | return patchesCopy; |
| 1949 | } |
| 1950 | |
| 1951 | /** |
| 1952 | * Merge a set of patches onto the text. Return a patched text, as well |