Package org.apache.commons.lang.builder

Examples of org.apache.commons.lang.builder.CompareToBuilder


* On large datasets, the constructed solution looks like a zebra crossing.
*/
public class LatitudeCustomerDifficultyComparator implements Comparator<Customer>, Serializable {

    public int compare(Customer a, Customer b) {
        return new CompareToBuilder()
                .append(a.getLocation().getLatitude(), b.getLocation().getLatitude())
                .append(a.getLocation().getLongitude(), b.getLocation().getLongitude())
                .append(a.getDemand(), b.getDemand())
                .append(a.getId(), b.getId())
                .toComparison();
View Full Code Here


            this.depotAngle = depotAngle;
            this.depotRoundTripDistance = depotRoundTripDistance;
        }

        public int compareTo(DepotAngleCustomerDifficultyWeight other) {
            return new CompareToBuilder()
                    .append(depotAngle, other.depotAngle)
                    .append(depotRoundTripDistance, other.depotRoundTripDistance) // Ascending (further from the depot are more difficult)
                    .append(customer.getId(), other.customer.getId())
                    .toComparison();
        }
View Full Code Here

            this.customer = customer;
            this.depotRoundTripDistance = depotRoundTripDistance;
        }

        public int compareTo(DepotDistanceCustomerDifficultyWeight other) {
            return new CompareToBuilder()
                    .append(depotRoundTripDistance, other.depotRoundTripDistance) // Ascending (further from the depot are more difficult)
                    .append(customer.getDemand(), other.customer.getDemand())
                    .append(customer.getLocation().getLatitude(), other.customer.getLocation().getLatitude())
                    .append(customer.getLocation().getLongitude(), other.customer.getLocation().getLongitude())
                    .append(customer.getId(), other.customer.getId())
View Full Code Here

        @Override
        public int compare(TaskAssignment a, TaskAssignment b) {
            Machine aMachine = a.getMachine();
            Machine bMachine = b.getMachine();
            return new CompareToBuilder()
                    .append(aMachine == null ? null : aMachine.getId(), bMachine == null ? null : bMachine.getId())
                    .append(a.getStartPeriod(), b.getStartPeriod())
                    .append(a.getTask().getDuration(), b.getTask().getDuration())
                    .append(a.getId(), b.getId())
                    .toComparison();
View Full Code Here

import org.optaplanner.benchmark.impl.result.SingleBenchmarkResult;

public class SingleBenchmarkRankingComparator implements Comparator<SingleBenchmarkResult>, Serializable {

    public int compare(SingleBenchmarkResult a, SingleBenchmarkResult b) {
        return new CompareToBuilder()
                .append(a.isFailure(), b.isFailure())
                .append(a.getScore(), b.getScore())
                .toComparison();
    }
View Full Code Here

public class TaskAssignmentDifficultyComparator implements Comparator<TaskAssignment>, Serializable {

    public int compare(TaskAssignment a, TaskAssignment b) {
        Task aTask = a.getTask();
        Task bTask = b.getTask();
        return new CompareToBuilder()
                .append(aTask.getResourceUsageMultiplicand(), bTask.getResourceUsageMultiplicand())
                .append(aTask.getPowerConsumptionMicros(), bTask.getPowerConsumptionMicros())
                .append(aTask.getDuration(), bTask.getDuration())
                .append(a.getId(), b.getId())
                .toComparison();
View Full Code Here

            = new ResilientScoreComparator();
    private final WorstScoreSolverRankingComparator worstScoreSolverRankingComparator
            = new WorstScoreSolverRankingComparator();

    public int compare(SolverBenchmarkResult a, SolverBenchmarkResult b) {
        return new CompareToBuilder()
                .append(a.getTotalScore(), b.getTotalScore(), resilientScoreComparator)
                .append(a, b, worstScoreSolverRankingComparator)
                .toComparison();
    }
View Full Code Here

            this.betterCount = betterCount;
            this.equalCount = equalCount;
        }

        public int compareTo(TotalRankSolverRankingWeight other) {
            return new CompareToBuilder()
                    .append(betterCount, other.betterCount)
                    .append(equalCount, other.equalCount)
                    .append(solverBenchmarkResult, other.solverBenchmarkResult, totalScoreSolverRankingComparator)
                    .toComparison();
        }
View Full Code Here

        return constraintPackage + "/" + constraintName + "/level" + scoreLevel + "/" + justificationList;
    }

    @Override
    public int compareTo(ConstraintMatch other) {
        return new CompareToBuilder()
                .append(getConstraintPackage(), other.getConstraintPackage())
                .append(getConstraintName(), other.getConstraintName())
                .append(getScoreLevel(), other.getScoreLevel())
                .append(getJustificationList(), other.getJustificationList())
                .append(getWeightAsNumber(), other.getWeightAsNumber())
View Full Code Here

        return constraintPackage + "/" + constraintName + "/level" + scoreLevel;
    }

    @Override
    public int compareTo(ConstraintMatchTotal other) {
        return new CompareToBuilder()
                .append(getScoreLevel(), other.getScoreLevel())
                .append(getConstraintPackage(), other.getConstraintPackage())
                .append(getConstraintName(), other.getConstraintName())
                .append(getWeightTotalAsNumber(), other.getWeightTotalAsNumber())
                .toComparison();
View Full Code Here

TOP

Related Classes of org.apache.commons.lang.builder.CompareToBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.