com.google.protobuf.Message.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(224)

本文整理了Java中com.google.protobuf.Message.hashCode()方法的一些代码示例,展示了Message.hashCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.hashCode()方法的具体详情如下:
包路径:com.google.protobuf.Message
类名称:Message
方法名:hashCode

Message.hashCode介绍

[英]Returns the hash code value for this message. The hash code of a message should mix the message's type (object identity of the descriptor) with its contents (known and unknown field values). Subclasses must implement this; inheriting Object.hashCode() is incorrect.
[中]返回此消息的哈希代码值。消息的哈希代码应该将消息的类型(描述符的对象标识)与其内容(已知和未知字段值)混合在一起。子类必须实现这一点;继承对象。hashCode()不正确。

代码示例

代码示例来源:origin: com.google.template/soy

  1. @Override
  2. public int hashCode() {
  3. int h = 1;
  4. h *= 1000003;
  5. h ^= (this.id >>> 32) ^ this.id;
  6. h *= 1000003;
  7. h ^= (data == null) ? 0 : this.data.hashCode();
  8. h *= 1000003;
  9. h ^= this.logOnly ? 1231 : 1237;
  10. return h;
  11. }

代码示例来源:origin: google/closure-templates

  1. @Override
  2. public int hashCode() {
  3. return this.proto.hashCode();
  4. }

代码示例来源:origin: org.apache.tajo/tajo-common

  1. @Override
  2. public int hashCode() {
  3. return value.hashCode();
  4. }

代码示例来源:origin: apache/tajo

  1. @Override
  2. public int hashCode() {
  3. return value.hashCode();
  4. }

代码示例来源:origin: com.google.template/soy

  1. @Override
  2. public int hashCode() {
  3. return this.proto.hashCode();
  4. }

代码示例来源:origin: stackoverflow.com

  1. private static final int NUM_PROCESSING_QUEUES = 6;
  2. ...
  3. ExecutorService[] pools = new ExecutorService[NUM_PROCESSING_QUEUES];
  4. for (int i = 0; i < pools.length; i++) {
  5. pools[i] = Executors.newSingleThreadExecutor();
  6. }
  7. ...
  8. // receiver loop:
  9. while (true) {
  10. Message message = receiveMessage();
  11. int hash = Math.abs(message.hashCode());
  12. // put each message in the appropriate pool based on its hash
  13. // this assumes message is runnable
  14. pools[hash % pools.length].submit(message);
  15. }

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common

  1. @Override
  2. public int hashCode() {
  3. return getProto().hashCode();
  4. }

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common

  1. @Override
  2. public int hashCode() {
  3. return getProto().hashCode();
  4. }

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-common

  1. @Override
  2. public int hashCode() {
  3. return getProto().hashCode();
  4. }

代码示例来源:origin: FoundationDB/fdb-record-layer

  1. @Override
  2. public int hashCode() {
  3. int result = primaryKey.hashCode();
  4. result = 31 * result + recordType.getName().hashCode();
  5. result = 31 * result + record.hashCode();
  6. result = 31 * result + keyCount;
  7. result = 31 * result + keySize;
  8. result = 31 * result + valueSize;
  9. if (recordVersion != null) {
  10. result = 31 * result + recordVersion.hashCode();
  11. }
  12. return result;
  13. }

代码示例来源:origin: org.openbase.bco/dal.lib

  1. public UnitDataFilteredObservable(final DataProvider<M> dataProvider, final ServiceTempus serviceTempus, final UnitTemplate unitTemplate) {
  2. super(dataProvider);
  3. this.unit = dataProvider;
  4. this.serviceTempus = serviceTempus;
  5. this.setHashGenerator((M value) -> removeUnwantedServiceTempus(value.toBuilder()).build().hashCode());
  6. this.fieldsToKeep = new HashSet<>();
  7. this.unitTemplate = unitTemplate;
  8. if (unitTemplate != null) {
  9. updateFieldsToKeep();
  10. }
  11. }

代码示例来源:origin: org.openbase.bco/dal.lib

  1. public ServiceDataFilteredObservable(final DataProvider<M> source) {
  2. super(source);
  3. this.setHashGenerator((M value) -> removeResponsibleActoin(removeTimestamps(value.toBuilder())).build().hashCode());
  4. }

相关文章