MCPcopy Create free account
hub / github.com/LianjiaTech/json-diff / DiffContext

Class DiffContext

src/main/java/com/ke/diff/model/DiffContext.java:12–61  ·  view source on GitHub ↗

diff比较上下文 @Author JingWei @create 2022/3/2

Source from the content-addressed store, hash-verified

10 * @create 2022/3/2
11 */
12public class DiffContext {
13 /**
14 * 比较结果是否相同
15 */
16 private boolean isSame;
17
18 /**
19 * 比较结果不同时,存储所有不同的结果对
20 */
21 private List<SingleNodeDifference> singleNodeDifferences;
22
23 /**
24 * 比较结果中,出现了特殊路径下值相等的情况,会存储该特殊路径。
25 */
26 private LinkedList<String> specialPathResult;
27
28 public DiffContext(boolean isSame) {
29 this.isSame = isSame;
30 this.singleNodeDifferences = new ArrayList<>();
31 }
32
33 public boolean isSame() {
34 return isSame;
35 }
36
37 public void setSame(boolean same) {
38 isSame = same;
39 }
40
41 public List<SingleNodeDifference> getDiffResultModels() {
42 return singleNodeDifferences;
43 }
44
45 public void setDiffResultModels(List<SingleNodeDifference> singleNodeDifferences) {
46 this.singleNodeDifferences = singleNodeDifferences;
47 }
48
49 public DiffContext() {
50 this.isSame = true;
51 this.singleNodeDifferences = new ArrayList<>();
52 }
53
54 public LinkedList<String> getSpecialPathResult() {
55 return specialPathResult;
56 }
57
58 public void setSpecialPathResult(LinkedList<String> specialPathResult) {
59 this.specialPathResult = specialPathResult;
60 }
61}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected