@param a 要比较的第一个JsonElement @param b 要比较的第二个JsonElement @return 用来展示的diff结果
(JsonElement a, JsonElement b)
| 54 | * @return 用来展示的diff结果 |
| 55 | */ |
| 56 | public List<Result> diffElement(JsonElement a, JsonElement b) { |
| 57 | DiffContext diffContext; |
| 58 | //用噪音路径和自定义路径构造路径模型 |
| 59 | PathModule pathModule = new PathModule(noisePahList, specialPath); |
| 60 | //如果有算法模型直接使用算法模型 |
| 61 | if(algorithmEnum != null){ |
| 62 | diffContext = algorithmEnum.getAlgorithmModule().diffElement(a, b, pathModule); |
| 63 | }//如果也没有比较器,直接用默认算法模型 |
| 64 | else if(objectComparator == null && arrayComparator == null && primitiveComparator == null && nullComparator == null && otherComparator == null){ |
| 65 | diffContext = AlgorithmEnum.DEFAULT.getAlgorithmModule().diffElement(a, b, pathModule); |
| 66 | }//如果有比较器,为空的比较器用默认替换,然后构造算法模型, |
| 67 | else { |
| 68 | constrcutDefaultComparator(); |
| 69 | diffContext = new AlgorithmModule(objectComparator, arrayComparator, primitiveComparator, nullComparator, otherComparator).diffElement(a, b, pathModule); |
| 70 | } |
| 71 | return ResultConvertUtil.constructResult(diffContext); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * @param strA 要比较的第一个字符串 |
no test coverage detected