Java 类org.apache.commons.lang3.builder.CompareToBuilder 实例源码

项目:scalarization    文件:CompareToBuilderTest.java   
@Test
public void compareToBuilderIsNOTScalarized() throws Exception {
    assertThat(
            new Scenario() {
                @Override
                public long run() {
                    return new CompareToBuilder()
                            .append( "34543", "34543" )
                            .append( true, true )
                            .append( 'A', 'A' )
                            .append( 1.45f, 1.5f )
                            .toComparison();
                }
            },
            finallyAllocatesSomething()
    );
}
项目:gluten    文件:EditServlet.java   
private List<TranscriptFileInfo> findFileList(TranscriptService tserv, String user, List<State> states) {
    List<TranscriptFileInfo> files = new ArrayList<TranscriptFileInfo>();

    //Just grab all the files - note that we don't care about duplicates
    for(State state: states) {
        Map<String, List<TranscriptFileInfo>> found = tserv.findAllFiles(user, state, null);
        for(List<TranscriptFileInfo> oneList: found.values()) {
            files.addAll(oneList);
        }
    }

    //Now sort
    Collections.sort(files, new Comparator<TranscriptFileInfo>(){
        @Override
        public int compare(TranscriptFileInfo lhs, TranscriptFileInfo rhs) {
            return new CompareToBuilder()
                .append(lhs.getFileName(), rhs.getFileName(), String.CASE_INSENSITIVE_ORDER)
                .append(lhs.getState().ordinal(), rhs.getState().ordinal())
                .toComparison();
        }
    });

    return files;
}
项目:lavagna    文件:CardService.java   
public List<CardFullWithCounts> fetchAllInColumn(int columnId) {

        List<CardFull> cards = cardRepository.findAllByColumnId(columnId);
        if (cards.isEmpty()) {
            return Collections.emptyList();
        }
        List<CardFullWithCounts> res = fetchCardFull(cards);

        Collections.sort(res, new Comparator<CardFullWithCounts>() {
            @Override
            public int compare(CardFullWithCounts o1, CardFullWithCounts o2) {
                return new CompareToBuilder().append(o1.getOrder(), o2.getOrder()).toComparison();
            }
        });
        //
        return res;
    }
项目:bgp-ls    文件:AddressFamilyRoutingConfigurationImpl.java   
@Override
public int compareTo(AddressFamilyRoutingConfiguration o) {
    CompareToBuilder builder = (new CompareToBuilder())
            .append(getKey(), o.getKey())
            .append(getRoutes().size(), o.getRoutes().size());

    if(builder.toComparison() == 0) {
        Iterator<RouteConfiguration> lit = getRoutes().iterator();
        Iterator<RouteConfiguration> rit = o.getRoutes().iterator();

        while(lit.hasNext())
            builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
}
项目:bgp-ls    文件:PathAttributeConfigurationImpl.java   
@Override
public int compareTo(PathAttributeConfiguration o) {
    CompareToBuilder builder = new CompareToBuilder();

    builder.append(getAttributes().size(), o.getAttributes().size());

    if(builder.toComparison() == 0) {
        Iterator<PathAttribute> lit = getAttributes().iterator();
        Iterator<PathAttribute> rit = o.getAttributes().iterator();

        while(lit.hasNext())
            builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
}
项目:bgp-ls    文件:OutboundRouteFilteringCapability.java   
@Override
protected int compareToSubclass(Capability other) {
    OutboundRouteFilteringCapability orc = (OutboundRouteFilteringCapability)other;
    CompareToBuilder builder = new CompareToBuilder();

    builder.append(getAddressFamily(), orc.getAddressFamily())
        .append(getSubsequentAddressFamily(), orc.getSubsequentAddressFamily())
        .append(getFilters().size(), orc.getFilters()
                .size());

    if(builder.toComparison() != 0)
        return builder.toComparison();

    Iterator<ORFType> hSet = getFilters().keySet().iterator();
    Iterator<ORFType> oSet = orc.getFilters().keySet().iterator();

    while(hSet.hasNext()) {
        ORFType hType = hSet.next();
        ORFType oType = oSet.next();

        builder.append(hType, oType).append(getFilters().get(hType), orc.getFilters().get(oType));
    }

    return builder.toComparison();
}
项目:bgp-ls    文件:ASPathAttribute.java   
@Override
protected int subclassCompareTo(PathAttribute obj) {
    ASPathAttribute o = (ASPathAttribute)obj;

    CompareToBuilder builder = (new CompareToBuilder())
            .append(getAsType(), o.getAsType())
            .append(getPathSegments().size(), o.getPathSegments().size());

    if(builder.toComparison() == 0) {
        Iterator<PathSegment> lit = getPathSegments().iterator();
        Iterator<PathSegment> rit = o.getPathSegments().iterator();

        while(lit.hasNext())
            builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
}
项目:bgp-ls    文件:MultiProtocolNLRI.java   
@Override
protected int subclassCompareTo(PathAttribute obj) {
    MultiProtocolNLRI o = (MultiProtocolNLRI)obj;

    CompareToBuilder builer = (new CompareToBuilder())
            .append(getPathAttributeType(), o.getPathAttributeType())
            .append(getAddressFamily(), o.getAddressFamily())
            .append(getSubsequentAddressFamily(), o.getSubsequentAddressFamily())
            .append(getNextHop(), o.getNextHop())
            .append(getNlris().size(), o.getNlris().size());

    if(builer.toComparison() == 0) {
        Iterator<MultiProtocolNLRIInformation> lit = getNlris().iterator();
        Iterator<MultiProtocolNLRIInformation> rit = o.getNlris().iterator();

        while(lit.hasNext())
            builer.append(lit.next(), rit.next());
    }

    return builer.toComparison();
}
项目:bgp-ls    文件:CommunityPathAttribute.java   
@Override
protected int subclassCompareTo(PathAttribute obj) {
    CommunityPathAttribute o = (CommunityPathAttribute)obj;
    CompareToBuilder builder = (new CompareToBuilder())
        .append(getCommunity(), o.getCommunity())
        .append(getMembers().size(), o.getMembers().size());

    if(builder.toComparison() == 0) {
        Iterator<CommunityMember> lit = getMembers().iterator();
        Iterator<CommunityMember> rit = o.getMembers().iterator();

        while(lit.hasNext())
            builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
}
项目:bgp-ls    文件:ClusterListPathAttribute.java   
@Override
protected int subclassCompareTo(PathAttribute obj) {
    CompareToBuilder builder = new CompareToBuilder();
    ClusterListPathAttribute o = (ClusterListPathAttribute)obj;

    builder.append(getClusterIds().size(), o.getClusterIds().size());

    if(builder.toComparison() == 0) {
        Iterator<Integer> lit = getClusterIds().iterator();
        Iterator<Integer> rit = o.getClusterIds().iterator();

        while(lit.hasNext())
            builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
}
项目:bgp-ls    文件:PathSegment.java   
@Override
public int compareTo(PathSegment o) {
    CompareToBuilder builder = (new CompareToBuilder())
            .append(getAsType(), o.getAsType())
            .append(getPathSegmentType(), o.getPathSegmentType())
            .append(getAses().size(), o.getAses().size());

    if(builder.toComparison() == 0) {
        Iterator<Integer> lit = getAses().iterator();
        Iterator<Integer> rit = o.getAses().iterator();

        while(lit.hasNext())
            builder.append(lit.next(), rit.next());
    }

    return builder.toComparison();
}
项目:rotabuilder    文件:EmployeeFreeSequence.java   
public int compareTo(EmployeeFreeSequence other) {
    return new CompareToBuilder()
            .append(employee, other.employee)
            .append(firstDayIndex, other.firstDayIndex)
            .append(lastDayIndex, other.lastDayIndex)
            .toComparison();
}
项目:rotabuilder    文件:EmployeeWeekendSequence.java   
public int compareTo(EmployeeWeekendSequence other) {
    return new CompareToBuilder()
            .append(employee, other.employee)
            .append(firstSundayIndex, other.firstSundayIndex)
            .append(lastSundayIndex, other.lastSundayIndex)
            .toComparison();
}
项目:rotabuilder    文件:EmployeeWorkSequence.java   
public int compareTo(EmployeeWorkSequence other) {
    return new CompareToBuilder()
            .append(employee, other.employee)
            .append(firstDayIndex, other.firstDayIndex)
            .append(lastDayIndex, other.lastDayIndex)
            .toComparison();
}
项目:rotabuilder    文件:EmployeeStrengthComparator.java   
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
//                .append(a.getId(), b.getId())
                .toComparison();
    }
项目:rotabuilder    文件:ShiftAssignmentDifficultyComparator.java   
public int compare(ShiftAssignment a, ShiftAssignment b) {
    Shift aShift = a.getShift();
    Shift bShift = b.getShift();
    return new CompareToBuilder()
                .append(bShift.getShiftDate(), aShift.getShiftDate()) // Descending
                .append(bShift.getShiftType(), aShift.getShiftType()) // Descending
                // For construction heuristics, scheduling the shifts in sequence is better
                .append(aShift.getRequiredEmployeeSize(), bShift.getRequiredEmployeeSize())
                .toComparison();
}
项目:springboot-shiro-cas-mybatis    文件:AbstractRegisteredService.java   
/**
 * {@inheritDoc}
 * Compares this instance with the {@code other} registered service based on
 * evaluation order, name. The name comparison is case insensitive.
 *
 * @see #getEvaluationOrder()
 */
@Override
public int compareTo(final RegisteredService other) {
    return new CompareToBuilder()
              .append(this.getEvaluationOrder(), other.getEvaluationOrder())
              .append(this.getName().toLowerCase(), other.getName().toLowerCase())
              .append(this.getServiceId(), other.getServiceId())
              .toComparison();
}
项目:springboot-shiro-cas-mybatis    文件:AbstractRegisteredService.java   
/**
 * {@inheritDoc}
 * Compares this instance with the <code>other</code> registered service based on
 * evaluation order, name. The name comparison is case insensitive.
 *
 * @see #getEvaluationOrder()
 */
@Override
public int compareTo(final RegisteredService other) {
    return new CompareToBuilder()
              .append(this.getEvaluationOrder(), other.getEvaluationOrder())
              .append(this.getName().toLowerCase(), other.getName().toLowerCase())
              .append(this.getServiceId(), other.getServiceId())
              .toComparison();
}
项目:cas-5.1.0    文件:OneTimeToken.java   
@Override
public int compareTo(final OneTimeToken o) {
    return new CompareToBuilder()
            .append(token, o.getToken())
            .append(userId, o.getUserId())
            .append(issuedDateTime, o.getIssuedDateTime())
            .build();
}
项目:cas-5.1.0    文件:OneTimeTokenAccount.java   
@Override
public int compareTo(final OneTimeTokenAccount o) {
    return new CompareToBuilder()
            .append(this.scratchCodes, o.getScratchCodes())
            .append(this.validationCode, o.getValidationCode())
            .append(this.secretKey, o.getSecretKey())
            .append(this.username, o.getUsername())
            .build();
}
项目:cas-5.1.0    文件:AbstractRegisteredService.java   
/**
 * {@inheritDoc}
 * Compares this instance with the {@code other} registered service based on
 * evaluation order, name. The name comparison is case insensitive.
 *
 * @see #getEvaluationOrder()
 */
@Override
public int compareTo(final RegisteredService other) {
    return new CompareToBuilder()
            .append(getEvaluationOrder(), other.getEvaluationOrder())
            .append(getName().toLowerCase(), other.getName().toLowerCase())
            .append(getServiceId(), other.getServiceId())
            .append(getId(), other.getId())
            .toComparison();
}
项目:syndesis    文件:MavenGav.java   
@Override
public int compareTo(MavenGav o) {
    return new CompareToBuilder()
        .append(this.groupId, o.groupId)
        .append(this.artifactId, o.artifactId)
        .append(this.type, o.type)
        .append(this.classifier, o.classifier)
        .append(this.version, o.version)
        .toComparison();
}
项目:cas-server-4.2.1    文件:AbstractRegisteredService.java   
/**
 * {@inheritDoc}
 * Compares this instance with the {@code other} registered service based on
 * evaluation order, name. The name comparison is case insensitive.
 *
 * @see #getEvaluationOrder()
 */
@Override
public int compareTo(final RegisteredService other) {
    return new CompareToBuilder()
              .append(this.getEvaluationOrder(), other.getEvaluationOrder())
              .append(this.getName().toLowerCase(), other.getName().toLowerCase())
              .append(this.getServiceId(), other.getServiceId())
              .toComparison();
}
项目:tutorial-optaplanner    文件:BundleDifficultyComparator.java   
@Override
public int compare(Bundle o1, Bundle o2) {
    return new CompareToBuilder()
            .append(o1.getCapacityRequired(), o2.getCapacityRequired())
            .append(o1.getId(), o2.getId())
            .toComparison();
}
项目:tutorial-optaplanner    文件:HostStrengthComparator.java   
@Override
public int compare(Host a, Host b) {
    return new CompareToBuilder()
            .append(a.getCapacity(), b.getCapacity())
            .append(a.getId(), b.getId())
            .toComparison();
}
项目:brick-pop-solver    文件:Point.java   
@Override
public int compareTo(final Point o) {
    return new CompareToBuilder()
        .append(x, o.x)
        .append(y, o.y)
        .toComparison();
}
项目:brick-pop-solver    文件:Coordinate.java   
@Override
public int compareTo(final Coordinate o) {
    return new CompareToBuilder()
        .append(column, o.column)
        .append(row, o.row)
        .toComparison();
}
项目:ABC-List    文件:Term.java   
@Override
public int compareTo(Term other) {
    return new CompareToBuilder()
            .append(this.getTitle(), other.getTitle())
            .append(this.getId(), other.getId())
            .append(this.getGenerationTime(), other.getGenerationTime())
            .toComparison();
}
项目:ABC-List    文件:ExerciseTerm.java   
@Override
public int compareTo(ExerciseTerm other) {
    return new CompareToBuilder()
            .append(this.getExerciseId(), other.getExerciseId())
            .append(this.getTermId(), other.getTermId())
            .append(this.getId(), other.getId())
            .toComparison();
}
项目:ABC-List    文件:NavigationEntity.java   
@Override
public int compareTo(NavigationEntity other) {
    return new CompareToBuilder()
            .append(this.getNavigation().getEntityId(), other.getNavigation().getEntityId())
            .append(this.getNavigation().getNavigationType(), other.getNavigation().getNavigationType())
            .toComparison();
}
项目:ABC-List    文件:Topic.java   
@Override
public int compareTo(Topic other) {
    return new CompareToBuilder()
            .append(this.getTitle(), other.getTitle())
            .append(this.getId(), other.getId())
            .append(this.getParentId(), other.getParentId())
            .toComparison();
}
项目:ABC-List    文件:Exercise.java   
@Override
public int compareTo(Exercise other) {
    return new CompareToBuilder()
            .append(other.getGenerationTime(), this.getGenerationTime())
            .append(other.getId(), this.getId())
            .append(other.getTopicId(), this.getTopicId())
            .toComparison();
}
项目:ABC-List    文件:LinkMapping.java   
@Override
public int compareTo(LinkMapping other) {
    return new CompareToBuilder()
            .append(this.getParentId(),             other.getParentId())
            .append(this.getChildId(),              other.getChildId())
            .append(this.getParentType().getType(), other.getParentType().getType())
            .append(this.getChildType().getType(),  other.getChildType().getType())
            .append(this.getId(),                   other.getId())
            .toComparison();
}
项目:ABC-List    文件:Link.java   
@Override
public int compareTo(Link other) {
    return new CompareToBuilder()
            .append(this.getId(), other.getId())
            .append(this.getGenerationTime(), other.getGenerationTime())
            .append(this.getAlias(), other.getAlias())
            .toComparison();
}
项目:java-cloud-filesystem-provider    文件:CloudAclEntry.java   
@Override
public int compareTo(CloudAclEntry<T> other) {
    return new CompareToBuilder()
        .append(principalClass.getName(), other.principalClass.getName())
        .append(principal, other.principal)
        .append(type, other.type)
        .append(flags.toArray(), other.flags.toArray())
        .append(permissions.toArray(), other.permissions.toArray())
        .toComparison();
}
项目:scalarization    文件:CompareToBuilderScenario.java   
@Override
public long run() {
    final CompareToBuilder builder = new CompareToBuilder();
    for( final String key : keys ) {
        builder.append( key, key );
    }
    return builder
            .append( true, true )
            .append( 1.1, 1.2 )
            .append( 1, 1 )
            .toComparison();
}
项目:Incubator    文件:DailySectionModel.java   
@Override
public int compareTo(DailySectionModel other) {
    return new CompareToBuilder()
            .append(this.getDailyDate(), other.getDailyDate())
            .append(this.getProjectId(), other.getProjectId())
            .append(this.getId(), other.getId())
            .toComparison();
}
项目:Incubator    文件:ProjectModel.java   
@Override
public int compareTo(ProjectModel other) {
    return new CompareToBuilder()
            .append(other.getGenerationTime(), this.getGenerationTime())
            .append(other.getTitle(), this.getTitle())
            .append(other.getId(), this.getId())
            .toComparison();
}
项目:Incubator    文件:CardModel.java   
@Override
public int compareTo(CardModel other) {
    return new CompareToBuilder()
            .append(this.getId(), other.getId())
            .append(this.getGenerationTime(), other.getGenerationTime())
            .toComparison();
}
项目:Incubator    文件:CategoryModel.java   
@Override
public int compareTo(CategoryModel other) {
    return new CompareToBuilder()
            .append(this.getId(), other.getId())
            .append(this.getSectionId(), other.getSectionId())
            .append(this.getTitle(), other.getTitle())
            .toComparison();
}