GeezerVison is showing github.com — remove verification from applyTo · lzhang7758/java-diff-utils@3075742
File tree
Expand file treeCollapse file tree
Open diff view settings
java-diff-utils/src/main/java/com/github/difflib/patch
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: java-diff-utils/src/main/java/com/github/difflib/patch/AbstractDelta.java +10-2Lines changed: 10 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -57,10 +57,18 @@ public DeltaType getType() { |
57 | 57 | protected VerifyChunk verifyChunkToFitTarget(List<T> target) throws PatchFailedException { |
58 | 58 | return getSource().verifyChunk(target); |
59 | 59 | } |
| 60 | + |
| 61 | + protected VerifyChunk verifyAntApplyTo(List<T> target) throws PatchFailedException { |
| 62 | + final VerifyChunk verify = verifyChunkToFitTarget(target); |
| 63 | + if (verify == VerifyChunk.OK) { |
| 64 | + applyTo(target); |
| 65 | + } |
| 66 | + return verify; |
| 67 | + } |
60 | 68 |
|
61 | | - public abstract void applyTo(List<T> target) throws PatchFailedException; |
| 69 | + protected abstract void applyTo(List<T> target) throws PatchFailedException; |
62 | 70 |
|
63 | | - public abstract void restore(List<T> target); |
| 71 | + protected abstract void restore(List<T> target); |
64 | 72 |
|
65 | 73 | /** |
66 | 74 | * Create a new delta of the actual instance with customized chunk data. |
|
Collapse file
Copy file name to clipboardExpand all lines: java-diff-utils/src/main/java/com/github/difflib/patch/ChangeDelta.java +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,8 +39,7 @@ public ChangeDelta(Chunk<T> source, Chunk<T> target) { |
39 | 39 | } |
40 | 40 |
|
41 | 41 | @Override |
42 | | - public void applyTo(List<T> target) throws PatchFailedException { |
43 | | - verifyChunk(target); |
| 42 | + protected void applyTo(List<T> target) throws PatchFailedException { |
44 | 43 | int position = getSource().getPosition(); |
45 | 44 | int size = getSource().size(); |
46 | 45 | for (int i = 0; i < size; i++) { |
@@ -54,7 +53,7 @@ public void applyTo(List<T> target) throws PatchFailedException { |
54 | 53 | } |
55 | 54 |
|
56 | 55 | @Override |
57 | | - public void restore(List<T> target) { |
| 56 | + protected void restore(List<T> target) { |
58 | 57 | int position = getTarget().getPosition(); |
59 | 58 | int size = getTarget().size(); |
60 | 59 | for (int i = 0; i < size; i++) { |
|
Collapse file
Copy file name to clipboardExpand all lines: java-diff-utils/src/main/java/com/github/difflib/patch/DeleteDelta.java +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -36,8 +36,7 @@ public DeleteDelta(Chunk<T> original, Chunk<T> revised) { |
36 | 36 | } |
37 | 37 |
|
38 | 38 | @Override |
39 | | - public void applyTo(List<T> target) throws PatchFailedException { |
40 | | - verifyChunk(target); |
| 39 | + protected void applyTo(List<T> target) throws PatchFailedException { |
41 | 40 | int position = getSource().getPosition(); |
42 | 41 | int size = getSource().size(); |
43 | 42 | for (int i = 0; i < size; i++) { |
@@ -46,7 +45,7 @@ public void applyTo(List<T> target) throws PatchFailedException { |
46 | 45 | } |
47 | 46 |
|
48 | 47 | @Override |
49 | | - public void restore(List<T> target) { |
| 48 | + protected void restore(List<T> target) { |
50 | 49 | int position = this.getTarget().getPosition(); |
51 | 50 | List<T> lines = this.getSource().getLines(); |
52 | 51 | for (int i = 0; i < lines.size(); i++) { |
|
Collapse file
Copy file name to clipboardExpand all lines: java-diff-utils/src/main/java/com/github/difflib/patch/EqualDelta.java +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,12 +28,11 @@ public EqualDelta(Chunk<T> source, Chunk<T> target) { |
28 | 28 | } |
29 | 29 |
|
30 | 30 | @Override |
31 | | - public void applyTo(List<T> target) throws PatchFailedException { |
32 | | - verifyChunk(target); |
| 31 | + protected void applyTo(List<T> target) throws PatchFailedException { |
33 | 32 | } |
34 | 33 |
|
35 | 34 | @Override |
36 | | - public void restore(List<T> target) { |
| 35 | + protected void restore(List<T> target) { |
37 | 36 | } |
38 | 37 |
|
39 | 38 | @Override |
|
Collapse file
Copy file name to clipboardExpand all lines: java-diff-utils/src/main/java/com/github/difflib/patch/InsertDelta.java +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -36,8 +36,7 @@ public InsertDelta(Chunk<T> original, Chunk<T> revised) { |
36 | 36 | } |
37 | 37 |
|
38 | 38 | @Override |
39 | | - public void applyTo(List<T> target) throws PatchFailedException { |
40 | | - verifyChunk(target); |
| 39 | + protected void applyTo(List<T> target) throws PatchFailedException { |
41 | 40 | int position = this.getSource().getPosition(); |
42 | 41 | List<T> lines = this.getTarget().getLines(); |
43 | 42 | for (int i = 0; i < lines.size(); i++) { |
@@ -46,7 +45,7 @@ public void applyTo(List<T> target) throws PatchFailedException { |
46 | 45 | } |
47 | 46 |
|
48 | 47 | @Override |
49 | | - public void restore(List<T> target) { |
| 48 | + protected void restore(List<T> target) { |
50 | 49 | int position = getTarget().getPosition(); |
51 | 50 | int size = getTarget().size(); |
52 | 51 | for (int i = 0; i < size; i++) { |
|