当前位置: 首页>>代码示例>>Java>>正文


Java CompareToBuilder类代码示例

本文整理汇总了Java中org.apache.commons.lang.builder.CompareToBuilder的典型用法代码示例。如果您正苦于以下问题:Java CompareToBuilder类的具体用法?Java CompareToBuilder怎么用?Java CompareToBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompareToBuilder类属于org.apache.commons.lang.builder包,在下文中一共展示了CompareToBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compareTo

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
public int compareTo(Qualifier o) {
	// The natural order of the qualifiers is the order in
	// which they should appear in the flat file.
	if (this.equals(o)) {
		return 0;
	}
	final CompareToBuilder builder = new CompareToBuilder();
	Integer thisOrder = ORDER_QUALS.get(this.name);
	if (thisOrder == null) {
		thisOrder = DEFAULT_ORDER_QUALS;
	}
	Integer otherOrder = ORDER_QUALS.get(o.name);
	if (otherOrder == null) {
		otherOrder = DEFAULT_ORDER_QUALS;
	}
	builder.append(thisOrder, otherOrder);
	return builder.toComparison();
}
 
开发者ID:enasequence,项目名称:sequencetools,代码行数:19,代码来源:Qualifier.java

示例2: compareTo

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compareTo(Step other) {
  // Sort steps by file and then sequentially within the file to achieve the
  // desired order.  There is no concurrent map structure in the JDK that
  // maintains insertion order, so instead we attach a sequence number to each
  // step and sort on read.
  return new CompareToBuilder().append(file, other.file)
    .append(sequenceNumber, other.sequenceNumber).toComparison();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:Step.java

示例3: compareTo

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
/**
 * Comparison method for natural ordering. Compares based on the logical
 * triple (the s/p/o/context information in the underlying RyaStatement)
 * and then by the metadata contained in the RyaStatement if the triples are
 * the same.
 * @return  Zero if both RyaStatementWritables contain equivalent statements
 *          or both have null statements; otherwise, an integer whose sign
 *          corresponds to a consistent ordering.
 */
@Override
public int compareTo(RyaStatementWritable other) {
    CompareToBuilder builder = new CompareToBuilder();
    RyaStatement rsThis = this.getRyaStatement();
    RyaStatement rsOther = other.getRyaStatement(); // should throw NPE if other is null, as per Comparable contract
    builder.append(rsThis == null, rsOther == null);
    if (rsThis != null && rsOther != null) {
        builder.append(rsThis.getSubject(), rsOther.getSubject());
        builder.append(rsThis.getPredicate(), rsOther.getPredicate());
        builder.append(rsThis.getObject(), rsOther.getObject());
        builder.append(rsThis.getContext(), rsOther.getContext());
        builder.append(rsThis.getQualifer(), rsOther.getQualifer());
        builder.append(rsThis.getColumnVisibility(), rsOther.getColumnVisibility());
        builder.append(rsThis.getValue(), rsOther.getValue());
        builder.append(rsThis.getTimestamp(), rsOther.getTimestamp());
    }
    return builder.toComparison();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:28,代码来源:RyaStatementWritable.java

示例4: putIndexNamesByRegion

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
public void putIndexNamesByRegion(IndexRegion bean)
{
  Set<IndexRegion> list = regionMap.get(bean.regionName());
  if (list == null)
  {
    list = new ConcurrentSkipListSet<IndexRegion>(new Comparator<IndexRegion>()
    {
      
      @Override
      public int compare(IndexRegion o1, IndexRegion o2)
      {
        
        return new CompareToBuilder().append(o1.orderNo(), o2.orderNo()).append(o1.indexName(), o2.indexName())
            .toComparison();
      }
    });
    
    regionMap.put(bean.regionName(), list);
  }
  
  list.add(bean);
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:23,代码来源:GemliteIndexContext.java

示例5: putIndexNamesByTestRegion

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
public void putIndexNamesByTestRegion(IndexRegion bean)
{
  Set<IndexRegion> list = testRegionMap.get(bean.regionName());
  if (list == null)
  {
    list = new ConcurrentSkipListSet<IndexRegion>(new Comparator<IndexRegion>()
    {
      
      @Override
      public int compare(IndexRegion o1, IndexRegion o2)
      {
        
        return new CompareToBuilder().append(o1.orderNo(), o2.orderNo()).append(o1.indexName(), o2.indexName())
            .toComparison();
      }
    });
    
    testRegionMap.put(bean.regionName(), list);
  }
  
  list.add(bean);
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:23,代码来源:GemliteIndexContext.java

示例6: compare

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compare(final GbStudentGradeInfo g1, final GbStudentGradeInfo g2) {
	final CourseGrade cg1 = g1.getCourseGrade().getCourseGrade();
	final CourseGrade cg2 = g2.getCourseGrade().getCourseGrade();

	String letterGrade1 = cg1.getMappedGrade();
	if (cg1.getEnteredGrade() != null) {
		letterGrade1 = cg1.getEnteredGrade();
	}
	String letterGrade2 = cg2.getMappedGrade();
	if (cg2.getEnteredGrade() != null) {
		letterGrade2 = cg2.getEnteredGrade();
	}

	final int gradeIndex1 = this.ascendingGrades.indexOf(letterGrade1);
	final int gradeIndex2 = this.ascendingGrades.indexOf(letterGrade2);

	final Double calculatedGrade1 = cg1.getCalculatedGrade() == null ? null : Double.valueOf(cg1.getCalculatedGrade());
	final Double calculatedGrade2 = cg2.getCalculatedGrade() == null ? null : Double.valueOf(cg2.getCalculatedGrade());

	return new CompareToBuilder()
			.append(gradeIndex1, gradeIndex2)
			.append(calculatedGrade1, calculatedGrade2)
			.toComparison();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:CourseGradeComparator.java

示例7: compare

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compare(VersionInfo o1, VersionInfo o2) {
    int value;

    if (o1 == o2) {
        return 0;
    }
    if (o1 == null) {
        value = -1;
    } else if (o2 == null) {
        value = +1;
    } else {
        value = new CompareToBuilder().append(o1.getTitle(), o2.getTitle()).toComparison();
    }
    return (ascending) ? value : -value;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:17,代码来源:VersionInfoTitleComparator.java

示例8: compare

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compare(VersionInfo o1, VersionInfo o2) {
    int value;

    if (o1 == o2) {
        return 0;
    }
    if (o1 == null) {
        value = -1;
    } else if (o2 == null) {
        value = +1;
    } else {
        value = new CompareToBuilder().append(o1.getRevision(), o2.getRevision()).toComparison();
    }
    return (ascending) ? value : -value;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:17,代码来源:VersionInfoRevisionComparator.java

示例9: compare

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compare(VersionInfo o1, VersionInfo o2) {
    int value;

    if (o1 == o2) {
        return 0;
    }
    if (o1 == null) {
        value = -1;
    } else if (o2 == null) {
        value = +1;
    } else {
        value = new CompareToBuilder().append(o1.getTimestamp(), o2.getTimestamp()).toComparison();
    }
    return (ascending) ? value : -value;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:17,代码来源:VersionInfoTimestampComparator.java

示例10: compare

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compare(VersionInfo o1, VersionInfo o2) {
    int value;

    if (o1 == o2) {
        return 0;
    }
    if (o1 == null) {
        value = -1;
    } else if (o2 == null) {
        value = +1;
    } else {
        value = new CompareToBuilder().append(o1.getVersion(), o2.getVersion()).toComparison();
    }
    return (ascending) ? value : -value;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:17,代码来源:VersionInfoVersionComparator.java

示例11: compare

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
@Override
public int compare(VersionInfo o1, VersionInfo o2) {
    int value;

    if (o1 == o2) {
        return 0;
    }
    if (o1 == null) {
        value = -1;
    } else if (o2 == null) {
        value = +1;
    } else {
        value = new CompareToBuilder().append(o1.getVendorId(), o2.getVendorId()).toComparison();
    }
    return (ascending) ? value : -value;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:17,代码来源:VersionInfoVendorIdComparator.java

示例12: convertToDto

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
private WrappedList<JsonEffectCurveCovariateInfluence> convertToDto(
        List<EffectCurveCovariateInfluence> effectCurveCovariateInfluences) {
    List<JsonEffectCurveCovariateInfluence> dtos = new ArrayList<>();
    if (!effectCurveCovariateInfluences.isEmpty()) {
        for (EffectCurveCovariateInfluence covariateInfluence : effectCurveCovariateInfluences) {
            dtos.add(new JsonEffectCurveCovariateInfluence(covariateInfluence));
        }
        Collections.sort(dtos, new Comparator<JsonEffectCurveCovariateInfluence>() {
            @Override
            public int compare(JsonEffectCurveCovariateInfluence o1, JsonEffectCurveCovariateInfluence o2) {
                return new CompareToBuilder()
                        .append(o1.getName(), o2.getName())
                        .append(o1.getCovariateValue(), o2.getCovariateValue())
                        .toComparison();
            }
        });
    }
    return new WrappedList<>(dtos);
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:20,代码来源:ModelRunDetailsController.java

示例13: getNextColumnTrackers

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
private List<ColumnTracker> getNextColumnTrackers(int maxVarsPerPdu) {
    List<ColumnTracker> trackers = new ArrayList<ColumnTracker>(maxVarsPerPdu);
    List<ColumnTracker> sortedTrackerList = new ArrayList<ColumnTracker>(m_columnTrackers);

    Collections.sort(sortedTrackerList, new Comparator<ColumnTracker>() {
        public int compare(ColumnTracker o1, ColumnTracker o2) {
            return new CompareToBuilder()
                .append(o1.getLastInstance(), o2.getLastInstance())
                .toComparison();
        }
    });
    
    for(Iterator<ColumnTracker> it = sortedTrackerList.iterator(); it.hasNext() && trackers.size() < maxVarsPerPdu; ) {
    
        ColumnTracker tracker = it.next();
        
        if (!tracker.isFinished()) {
            trackers.add(tracker);
        }

    }

    return trackers;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:25,代码来源:TableTracker.java

示例14: compareTo

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
/**
 * {@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();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:16,代码来源:AbstractRegisteredService.java

示例15: compareTo

import org.apache.commons.lang.builder.CompareToBuilder; //导入依赖的package包/类
/**
    * Sort the groups using order id.
    *
    * @see java.lang.Comparable#compareTo(java.lang.Object)
    */
   @Override
   public int compareTo(Group group) {
return new CompareToBuilder().append(this.getOrderId(), group.getOrderId())
	.append(this.getGroupId(), group.getGroupId()).append(this.getGroupName(), group.getGroupName())
	.append(this.getGroupUIID(), group.getGroupUIID()).toComparison();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:Group.java


注:本文中的org.apache.commons.lang.builder.CompareToBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。