Example usage for java.util Comparator interface-usage

List of usage examples for java.util Comparator interface-usage

Introduction

In this page you can find the example usage for java.util Comparator interface-usage.

Usage

From source file ontopoly.utils.TopicComparator.java

public class TopicComparator implements Comparator<Topic>, Serializable {

    public static final TopicComparator INSTANCE = new TopicComparator();

    private TopicComparator() {
        // don't call me

From source file InvertibleComparator.java

/**
 * A decorator for a comparator, with an "ascending" flag denoting
 * whether comparison results should be treated in forward (standard
 * ascending) order or flipped for reverse (descending) order.
 * 
 * @author Keith Donald

From source file org.optaplanner.examples.cloudbalancing.domain.solver.CloudProcessDifficultyComparator.java

public class CloudProcessDifficultyComparator implements Comparator<CloudProcess>, Serializable {

    public int compare(CloudProcess a, CloudProcess b) {
        return new CompareToBuilder().append(a.getRequiredMultiplicand(), b.getRequiredMultiplicand())
                .append(a.getId(), b.getId()).toComparison();
    }

From source file org.optaplanner.examples.nurserostering.domain.solver.EmployeeStrengthComparator.java

public class EmployeeStrengthComparator implements Comparator<Employee>, Serializable {

    public int compare(Employee a, Employee b) {
        // TODO refactor to DifficultyWeightFactory and use getContract().getContractLineList()
        // to sum maximumValue and minimumValue etc
        return new CompareToBuilder().append(b.getWeekendLength(), a.getWeekendLength()) // Descending

From source file mml.DocidComparator.java

/**
 * Comparator for annotations based on docid then version id
 * @author desmond
 */
public class DocidComparator implements Comparator<JSONObject> {
    public int compare(JSONObject obj1, JSONObject obj2) {

From source file ontopoly.utils.NameComparator.java

public class NameComparator implements Comparator<Object>, Serializable {

    public static final NameComparator INSTANCE = new NameComparator();

    @Override
    public int compare(Object o1, Object o2) {

From source file org.droolsplannerdelirium.travelingsanta.domain.solver.LatitudeVisitDifficultyComparator.java

public class LatitudeVisitDifficultyComparator implements Comparator<Visit>, Serializable {

    public int compare(Visit a, Visit b) {
        return new CompareToBuilder()
                // TODO experiment with (aLatitude - bLatitude) % 10
                .append(a.getCity().getLatitude(), b.getCity().getLatitude())

From source file org.droolsplannerdelirium.travelingsanta.domain.solver.LongitudeVisitDifficultyComparator.java

public class LongitudeVisitDifficultyComparator implements Comparator<Visit>, Serializable {

    public int compare(Visit a, Visit b) {
        return new CompareToBuilder()
                // TODO experiment with (aLongitude - bLongitude) % 10
                .append(a.getCity().getLongitude(), b.getCity().getLongitude())

From source file ontopoly.utils.OccurrenceComparator.java

public class OccurrenceComparator implements Comparator<Object>, Serializable {

    public static final OccurrenceComparator INSTANCE = new OccurrenceComparator();

    @Override
    public int compare(Object o1, Object o2) {

From source file org.finra.dm.service.helper.BusinessObjectDataKeyComparator.java

/**
 * A comparator that compares two business object data keys.
 */
public class BusinessObjectDataKeyComparator implements Comparator<BusinessObjectDataKey>, Serializable {
    private static final long serialVersionUID = -9075981888098266490L;