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


Java ComparisonChain类代码示例

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


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

示例1: compare

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
/**
 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
 */
@Override
public int compare(Pedigree o1, Pedigree o2) {
	int result = ComparisonChain.start()
	.compare(o1.getId(), o2.getId())
	.compare(o1.getTitle(), o2.getTitle(), Ordering.natural().nullsFirst())
	.compare(o1.getName(), o2.getName(), Ordering.natural().nullsFirst())
	.compare(o1.getGender(), o2.getGender(), Ordering.natural().nullsFirst())
	.compare(o1.getEms(), o2.getEms(), Ordering.natural().nullsFirst())
	.compare(o1.getDob(), o2.getDob(), Ordering.natural().nullsFirst())
	.compare(o1.getInbreeding(), o2.getInbreeding())
	.compare(o1.getDamId(), o2.getDamId(), Ordering.natural().nullsFirst())
	.compare(o1.getSireId(), o2.getSireId(), Ordering.natural().nullsFirst())
	.compare(o1.getLocationCountryCode(), o2.getLocationCountryCode(), Ordering.natural().nullsFirst())
	.compare(o1.getNationalityCountryCode(), o2.getNationalityCountryCode(), Ordering.natural().nullsFirst())
	.compare(o1.getOffsprings().size(), o2.getOffsprings().size())
	.result();
	if (result != 0) {
		return result;
	}
	Set<Long> offsprings = o1.getOffsprings();
	offsprings.removeAll(o2.getOffsprings());
	return offsprings.isEmpty() ? 0 : -1; // simplifying - not comparing id's in the sets
}
 
开发者ID:padriano,项目名称:catpeds,代码行数:27,代码来源:PedigreeComparator.java

示例2: equals

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof ResultVariables)) {
        return false;
    }
    ResultVariables other = (ResultVariables) obj;
    if (processingResult == null) {
        return false;
    }
    return ComparisonChain.start().compare(getTodo(), other.getTodo()).compare(getDone(), other.getDone()).compare(getErrors(), other.getErrors())
            .compare(getMistakes(), other.getMistakes()).compare(getLastMistaken(), other.getLastMistaken()).result() == 0;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:ResponseResultVariables.java

示例3: compare

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compare(final Answerable left, final Answerable right) {
  final Optional<Response> earliestLeftResponse = earliestResponse(left);
  final Optional<Response> earliestRightResponse = earliestResponse(right);

  if (earliestLeftResponse.isPresent()) {
    if (earliestRightResponse.isPresent()) {
      return ComparisonChain.start()
          .compare(earliestLeftResponse.get(), earliestRightResponse.get(),
              Response.ByJustificationLocation)
          .compare(left, right)
          .result();
    } else {
      return -1;
    }
  } else if (earliestRightResponse.isPresent()) {
    return 1;
  } else {
    return left.compareTo(right);
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:22,代码来源:ByJustificationLocation.java

示例4: DatatypeString

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
public DatatypeString(final Comparator<String> comparator) {
  this.specificType = type.STRING;

  if (comparator == null) {
    this.indexedComparator = new Comparator<RowIndexedStringValue>() {

      @Override
      public int compare(final RowIndexedStringValue o1, final RowIndexedStringValue o2) {
        return ComparisonChain.start()
            .compare(o1.value, o2.value, Ordering.natural().nullsFirst()).result();
      }

    };
  } else {
    this.indexedComparator = new Comparator<RowIndexedStringValue>() {

      @Override
      public int compare(final RowIndexedStringValue o1, final RowIndexedStringValue o2) {
        return ComparisonChain.start()
            .compare(o1.value, o2.value, Ordering.from(comparator).nullsFirst()).result();
      }

    };
  }

}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:27,代码来源:DatatypeString.java

示例5: DatatypeDate

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
public DatatypeDate(final Comparator<Date> comparator, final String dateFormat) {
  this.specificType = type.DATE;
  this.setDateFormat(dateFormat);

  if (comparator == null) {
    this.indexedComparator = new Comparator<RowIndexedDateValue>() {

      @Override
      public int compare(final RowIndexedDateValue o1, final RowIndexedDateValue o2) {
        return ComparisonChain.start()
            .compare(o1.value, o2.value, Ordering.natural().nullsFirst()).result();
      }

    };
  } else {
    this.indexedComparator = new Comparator<RowIndexedDateValue>() {

      @Override
      public int compare(final RowIndexedDateValue o1, final RowIndexedDateValue o2) {
        return ComparisonChain.start()
            .compare(o1.value, o2.value, Ordering.from(comparator).nullsFirst()).result();
      }

    };
  }
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:27,代码来源:DatatypeDate.java

示例6: DatatypeDouble

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
public DatatypeDouble(final Comparator<Double> comparator) {
  this.specificType = type.DOUBLE;

  if (comparator == null) {
    this.indexedComparator = new Comparator<RowIndexedDoubleValue>() {

      @Override
      public int compare(final RowIndexedDoubleValue o1, final RowIndexedDoubleValue o2) {
        return ComparisonChain.start()
            .compare(o1.value, o2.value, Ordering.natural().nullsFirst()).result();
      }

    };
  } else {
    this.indexedComparator = new Comparator<RowIndexedDoubleValue>() {

      @Override
      public int compare(final RowIndexedDoubleValue o1, final RowIndexedDoubleValue o2) {
        return ComparisonChain.start()
            .compare(o1.value, o2.value, Ordering.from(comparator).nullsFirst()).result();
      }

    };
  }

}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:27,代码来源:DatatypeDouble.java

示例7: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compareTo(TermAnnotation o) {
  if (!(o instanceof GoGaf21Annotation)) {
    throw new OntoLibRuntimeException(
        "Can only compare GoGaf21Annotation with objects of same type");
  }
  GoGaf21Annotation that = (GoGaf21Annotation) o;

  return ComparisonChain.start().compare(this.annotationExtension, that.annotationExtension)
      .compare(this.aspect, that.aspect).compare(this.assignedBy, that.assignedBy)
      .compare(this.date, that.date).compare(this.db, that.db)
      .compare(this.dbObjectId, that.dbObjectId).compare(this.dbObjectName, that.dbObjectName)
      .compare(this.dbObjectSymbol, that.dbObjectSymbol)
      .compare(this.dbObjectSynonym, that.dbObjectSynonym)
      .compare(this.dbObjectType, that.dbObjectType).compare(this.dbReference, that.dbReference)
      .compare(this.evidenceCode, that.evidenceCode)
      .compare(this.geneProductFormId, that.geneProductFormId).compare(this.goId, that.goId)
      .compare(this.qualifier, that.qualifier)
      .compare(this.taxons, that.taxons, Ordering.<String>natural().lexicographical())
      .compare(this.with, that.with).result();
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:22,代码来源:GoGaf21Annotation.java

示例8: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compareTo(TermAnnotation o) {
  if (!(o instanceof HpoDiseaseAnnotation)) {
    throw new OntoLibRuntimeException(
        "Can only compare HPODiseaseAnnotation with objects of same type");
  }
  HpoDiseaseAnnotation that = (HpoDiseaseAnnotation) o;

  return ComparisonChain.start().compare(this.db, that.db)
      .compare(this.dbObjectId, that.dbObjectId).compare(this.dbName, that.dbName)
      .compare(this.qualifier, that.qualifier).compare(this.hpoId, that.hpoId)
      .compare(this.dbReference, that.dbReference)
      .compare(this.evidenceDescription, that.evidenceDescription)
      .compare(this.onsetModifier, that.onsetModifier).compare(this.with, that.with)
      .compare(this.aspect, that.aspect).compare(this.synonym, that.synonym)
      .compare(this.date, that.date).compare(this.assignedBy, that.assignedBy).result();
}
 
开发者ID:johntiger1,项目名称:boqa,代码行数:18,代码来源:HpoDiseaseAnnotation.java

示例9: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
/** There should be no two edges with same start and end nodes. */
@Override
public int compareTo(ControlFlowEdge edge) {
	int result = ComparisonChain.start()
			.compare(start.id, edge.start.id)
			.compare(end.id, edge.end.id)
			.result();

	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:ControlFlowEdge.java

示例10: compareForRemoveFirst

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
private int compareForRemoveFirst(EdgeGuide eg1, EdgeGuide eg2) {
	return ComparisonChain.start()
			.compare(eg1, eg2, EdgeGuideQueue::compareASTPosition)
			.compare(eg1, eg2, EdgeGuideQueue::compareDeadFlowContext)
			.compare(eg1, eg2, EdgeGuideQueue::compareFinallyContext)
			.result();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:EdgeGuideQueue.java

示例11: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compareTo(AggregateCombo o) {
    return ComparisonChain.start()
            .compare(level, o.level)
            .compare(baseName, o.baseName)
            .result();
}
 
开发者ID:hylkevds,项目名称:SensorThingsProcessor,代码行数:8,代码来源:ProcessorBatchAggregate.java

示例12: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compareTo(Quantile other) {
  return ComparisonChain.start()
      .compare(quantile, other.quantile)
      .compare(error, other.error)
      .result();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:Quantile.java

示例13: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compareTo(Key other) {
  return ComparisonChain.start().
      compare(capacity, other.capacity).
      compare(insertionTime, other.insertionTime).
      result();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:ElasticByteBufferPool.java

示例14: compare

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compare(final Response left, final Response right) {
  return ComparisonChain.start()
      .compare(left.docID().toString(), right.docID().toString())
      .compare(
          Ordering.natural().sortedCopy(left.predicateJustifications()),
          Ordering.natural().sortedCopy(right.predicateJustifications()),
          Ordering.<CharOffsetSpan>natural().lexicographical())
      .compare(left.baseFiller(), right.baseFiller())
      .compare(left.canonicalArgument().charOffsetSpan(),
          right.canonicalArgument().charOffsetSpan())
      .compare(left.realis(), right.realis())
      .result();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:15,代码来源:_Response.java

示例15: compareTo

import com.google.common.collect.ComparisonChain; //导入依赖的package包/类
@Override
public int compareTo(final TypeRoleFillerRealis o) {
  return ComparisonChain.start()
      .compare(docID().toString(), o.docID().toString())
      .compare(type().toString(), o.type().toString())
      .compare(role().toString(), o.type().toString())
      .compare(realis(), o.realis())
      .compare(argumentCanonicalString(), argumentCanonicalString())
      .result();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:11,代码来源:_TypeRoleFillerRealis.java


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