All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.deps.difflib.DeltaComparator Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package difflib;

import java.io.Serializable;
import java.util.Comparator;

/**
 * @author mksenzov
 */
public class DeltaComparator implements Comparator, Serializable {
    private static final long serialVersionUID = 1L;
    public static final Comparator INSTANCE = new DeltaComparator();

    private DeltaComparator() {
    }

    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 - 2024 Weber Informatics LLC | Privacy Policy