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 org.sakaiproject.gradebookng.business.LetterGradeComparator.java

/**
 * Comparator to ensure correct ordering of letter grades, catering for + and - in the grade Copied from GradebookService and made
 * Serializable as we use it in a TreeMap. Also has the fix from SAK-30094. If this changes, be sure to update the other.
 */
public class LetterGradeComparator implements Comparator<String>, Serializable {

From source file org.jboss.qa.brms.performance.examples.tsp.domain.solver.LatitudeVisitDifficultyComparator.java

public class LatitudeVisitDifficultyComparator implements Comparator<Visit>, Serializable {

    @Override
    public int compare(Visit a, Visit b) {
        return new CompareToBuilder()
                // TODO experiment with (aLatitude - bLatitude) % 10

From source file org.jboss.qa.brms.performance.examples.tsp.domain.solver.LongitudeVisitDifficultyComparator.java

public class LongitudeVisitDifficultyComparator implements Comparator<Visit>, Serializable {

    @Override
    public int compare(Visit a, Visit b) {
        return new CompareToBuilder()
                // TODO experiment with (aLongitude - bLongitude) % 10

From source file ReverseOrder.java

/**
 * @author djemili
 */
public class ReverseOrder<T> implements Comparator<T> {
    private Comparator<T> m_comparator;

From source file org.drools.planner.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.drools.planner.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 org.finra.herd.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;

From source file org.drools.planner.examples.cloudbalancing.domain.solver.CloudComputerStrengthComparator.java

public class CloudComputerStrengthComparator implements Comparator<CloudComputer>, Serializable {

    public int compare(CloudComputer a, CloudComputer b) {
        return new CompareToBuilder().append(a.getMultiplicand(), b.getMultiplicand())
                .append(b.getCost(), a.getCost()) // Descending (but this is debatable)
                .append(a.getId(), b.getId()).toComparison();

From source file Main.java

class ColumnSorter implements Comparator {
    ColumnSorter() {
    }

    public int compare(Object a, Object b) {
        if (a instanceof String && ((String) a).length() == 0) {

From source file org.sventon.model.DirEntryComparator.java

/**
 * <code>java.util.Comparator&lt;T&gt;</code> implementation to support
 * ordering of <code>DirEntry</code> objects.
 * <p/>
 * The comparator can be configured during construction to tweak sorting behavior.
 *