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

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

本文整理了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

@Override
public int hashCode() {
 int h = 1;
 h *= 1000003;
 h ^= (this.id >>> 32) ^ this.id;
 h *= 1000003;
 h ^= (data == null) ? 0 : this.data.hashCode();
 h *= 1000003;
 h ^= this.logOnly ? 1231 : 1237;
 return h;
}

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

@Override
public int hashCode() {
 return this.proto.hashCode();
}

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

@Override
public int hashCode() {
 return value.hashCode();
}

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

@Override
public int hashCode() {
 return value.hashCode();
}

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

@Override
public int hashCode() {
 return this.proto.hashCode();
}

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

private static final int NUM_PROCESSING_QUEUES = 6;
...
ExecutorService[] pools = new ExecutorService[NUM_PROCESSING_QUEUES];
for (int i = 0; i < pools.length; i++) {
 pools[i] = Executors.newSingleThreadExecutor();
}
...
// receiver loop:
while (true) {
 Message message = receiveMessage();
 int hash = Math.abs(message.hashCode());
 // put each message in the appropriate pool based on its hash
 // this assumes message is runnable
 pools[hash % pools.length].submit(message);
}

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

@Override
public int hashCode() {
 return getProto().hashCode();
}

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

@Override
public int hashCode() {
 return getProto().hashCode();
}

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

@Override
public int hashCode() {
 return getProto().hashCode();
}

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

@Override
public int hashCode() {
  int result = primaryKey.hashCode();
  result = 31 * result + recordType.getName().hashCode();
  result = 31 * result + record.hashCode();
  result = 31 * result + keyCount;
  result = 31 * result + keySize;
  result = 31 * result + valueSize;
  if (recordVersion != null) {
    result = 31 * result + recordVersion.hashCode();
  }
  return result;
}

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

public UnitDataFilteredObservable(final DataProvider<M> dataProvider, final ServiceTempus serviceTempus, final UnitTemplate unitTemplate) {
  super(dataProvider);
  this.unit = dataProvider;
  this.serviceTempus = serviceTempus;
  this.setHashGenerator((M value) -> removeUnwantedServiceTempus(value.toBuilder()).build().hashCode());
  this.fieldsToKeep = new HashSet<>();
  this.unitTemplate = unitTemplate;
  if (unitTemplate != null) {
    updateFieldsToKeep();
  }
}

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

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

相关文章