T - Token 类型public abstract class Diff<T> extends Object
| 构造器和说明 |
|---|
Diff() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected String |
castInput(String value,
DiffOptions options)
允许子类在运行前处理输入
|
List<ChangeObject<String>> |
diff(String oldValue,
String newValue)
执行差异计算
|
List<ChangeObject<String>> |
diff(String oldValue,
String newValue,
DiffOptions options)
执行差异计算(带选项)
|
protected boolean |
equals(T left,
T right,
DiffOptions options)
比较两个 token 是否相等
|
protected String |
join(List<T> tokens)
将 token 数组连接成字符串
|
protected List<ChangeObject<String>> |
postProcess(List<ChangeObject<String>> changeObjects,
DiffOptions options)
后处理变化对象
|
protected List<T> |
removeEmpty(List<T> array)
移除数组中的空元素
|
protected abstract List<T> |
tokenize(String value,
DiffOptions options)
将值标记化为 token 数组
|
protected boolean |
useLongestToken()
是否使用最长的 token
|
public List<ChangeObject<String>> diff(String oldValue, String newValue)
oldValue - 旧值newValue - 新值public List<ChangeObject<String>> diff(String oldValue, String newValue, DiffOptions options)
oldValue - 旧值newValue - 新值options - 差异选项protected boolean equals(T left, T right, DiffOptions options)
protected String castInput(String value, DiffOptions options)
protected abstract List<T> tokenize(String value, DiffOptions options)
protected List<ChangeObject<String>> postProcess(List<ChangeObject<String>> changeObjects, DiffOptions options)
protected boolean useLongestToken()
Copyright © 2025. All rights reserved.