Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3075742

Browse files
committed
remove verification from applyTo
1 parentb9fea86 commit3075742

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

‎java-diff-utils/src/main/java/com/github/difflib/patch/AbstractDelta.java‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,18 @@ public DeltaType getType() {
5757
protectedVerifyChunkverifyChunkToFitTarget(List<T>target)throwsPatchFailedException {
5858
returngetSource().verifyChunk(target);
5959
}
60+
61+
protectedVerifyChunkverifyAntApplyTo(List<T>target)throwsPatchFailedException {
62+
finalVerifyChunkverify =verifyChunkToFitTarget(target);
63+
if (verify ==VerifyChunk.OK) {
64+
applyTo(target);
65+
}
66+
returnverify;
67+
}
6068

61-
publicabstractvoidapplyTo(List<T>target)throwsPatchFailedException;
69+
protectedabstractvoidapplyTo(List<T>target)throwsPatchFailedException;
6270

63-
publicabstractvoidrestore(List<T>target);
71+
protectedabstractvoidrestore(List<T>target);
6472

6573
/**
6674
* Create a new delta of the actual instance with customized chunk data.

‎java-diff-utils/src/main/java/com/github/difflib/patch/ChangeDelta.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public ChangeDelta(Chunk<T> source, Chunk<T> target) {
3939
}
4040

4141
@Override
42-
publicvoidapplyTo(List<T>target)throwsPatchFailedException {
43-
verifyChunk(target);
42+
protectedvoidapplyTo(List<T>target)throwsPatchFailedException {
4443
intposition =getSource().getPosition();
4544
intsize =getSource().size();
4645
for (inti =0;i <size;i++) {
@@ -54,7 +53,7 @@ public void applyTo(List<T> target) throws PatchFailedException {
5453
}
5554

5655
@Override
57-
publicvoidrestore(List<T>target) {
56+
protectedvoidrestore(List<T>target) {
5857
intposition =getTarget().getPosition();
5958
intsize =getTarget().size();
6059
for (inti =0;i <size;i++) {

‎java-diff-utils/src/main/java/com/github/difflib/patch/DeleteDelta.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public DeleteDelta(Chunk<T> original, Chunk<T> revised) {
3636
}
3737

3838
@Override
39-
publicvoidapplyTo(List<T>target)throwsPatchFailedException {
40-
verifyChunk(target);
39+
protectedvoidapplyTo(List<T>target)throwsPatchFailedException {
4140
intposition =getSource().getPosition();
4241
intsize =getSource().size();
4342
for (inti =0;i <size;i++) {
@@ -46,7 +45,7 @@ public void applyTo(List<T> target) throws PatchFailedException {
4645
}
4746

4847
@Override
49-
publicvoidrestore(List<T>target) {
48+
protectedvoidrestore(List<T>target) {
5049
intposition =this.getTarget().getPosition();
5150
List<T>lines =this.getSource().getLines();
5251
for (inti =0;i <lines.size();i++) {

‎java-diff-utils/src/main/java/com/github/difflib/patch/EqualDelta.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ public EqualDelta(Chunk<T> source, Chunk<T> target) {
2828
}
2929

3030
@Override
31-
publicvoidapplyTo(List<T>target)throwsPatchFailedException {
32-
verifyChunk(target);
31+
protectedvoidapplyTo(List<T>target)throwsPatchFailedException {
3332
}
3433

3534
@Override
36-
publicvoidrestore(List<T>target) {
35+
protectedvoidrestore(List<T>target) {
3736
}
3837

3938
@Override

‎java-diff-utils/src/main/java/com/github/difflib/patch/InsertDelta.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public InsertDelta(Chunk<T> original, Chunk<T> revised) {
3636
}
3737

3838
@Override
39-
publicvoidapplyTo(List<T>target)throwsPatchFailedException {
40-
verifyChunk(target);
39+
protectedvoidapplyTo(List<T>target)throwsPatchFailedException {
4140
intposition =this.getSource().getPosition();
4241
List<T>lines =this.getTarget().getLines();
4342
for (inti =0;i <lines.size();i++) {
@@ -46,7 +45,7 @@ public void applyTo(List<T> target) throws PatchFailedException {
4645
}
4746

4847
@Override
49-
publicvoidrestore(List<T>target) {
48+
protectedvoidrestore(List<T>target) {
5049
intposition =getTarget().getPosition();
5150
intsize =getTarget().size();
5251
for (inti =0;i <size;i++) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp