
pw.prok.kdiff.delta.DeltaComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kDiff Show documentation
Show all versions of kDiff Show documentation
Library for generating and applying diff/patch files
The newest version!
package pw.prok.kdiff.delta;
import java.io.Serializable;
import java.util.Comparator;
/**
* Compares delta by original positions
*/
public class DeltaComparator implements Comparator>, Serializable {
private static final long serialVersionUID = 1L;
public static final Comparator> INSTANCE = new DeltaComparator();
private DeltaComparator() {
}
@Override
public int compare(final Delta> a, final Delta> b) {
final int posA = a.getOriginal().getPosition();
final int posB = b.getOriginal().getPosition();
if (posA > posB) {
return 1;
} else if (posA < posB) {
return -1;
}
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy