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

edu.stanford.protege.webprotege.change.ProjectChangeTimestampComparator Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.change;

import java.util.Comparator;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 27/02/15
 */
public class ProjectChangeTimestampComparator implements Comparator {

    private static final int ONE_BEFORE_TWO = -1;

    private static final int SAME = 0;

    private static final int ONE_AFTER_TWO = 1;

    @Override
    public int compare(ProjectChange o1, ProjectChange o2) {
        long timestamp1 = o1.getTimestamp();
        long timestamp2 = o2.getTimestamp();
        if(timestamp1 < timestamp2) {
            return ONE_BEFORE_TWO;
        }
        else if(timestamp1 == timestamp2) {
            return SAME;
        }
        else {
            return ONE_AFTER_TWO;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy