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

x33g5p2x  于2022-01-16 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(142)

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

ByteString.partialHash介绍

[英]Compute the hash across the value bytes starting with the given hash, and return the result. This is used to compute the hash across strings represented as a set of pieces by allowing the hash computation to be continued from piece to piece.
[中]计算从给定哈希开始的值字节的哈希,并返回结果。这用于通过允许散列计算从一个片段到另一个片段继续,跨表示为一组片段的字符串计算散列。

代码示例

代码示例来源:origin: osmandapp/Osmand

@Override
protected int partialHash(int h, int offset, int length) {
 int toIndex = offset + length;
 if (toIndex <= leftLength) {
  return left.partialHash(h, offset, length);
 } else if (offset >= leftLength) {
  return right.partialHash(h, offset - leftLength, length);
 } else {
  int leftLength = this.leftLength - offset;
  int leftPartial = left.partialHash(h, offset, leftLength);
  return right.partialHash(leftPartial, 0, length - leftLength);
 }
}

代码示例来源:origin: com.google.protobuf/protobuf-java

@Override
protected int partialHash(int h, int offset, int length) {
 int toIndex = offset + length;
 if (toIndex <= leftLength) {
  return left.partialHash(h, offset, length);
 } else if (offset >= leftLength) {
  return right.partialHash(h, offset - leftLength, length);
 } else {
  int leftLength = this.leftLength - offset;
  int leftPartial = left.partialHash(h, offset, leftLength);
  return right.partialHash(leftPartial, 0, length - leftLength);
 }
}

代码示例来源:origin: com.google.protobuf/protobuf-java

/**
 * Compute the hashCode using the traditional algorithm from {@link
 * ByteString}.
 *
 * @return hashCode value
 */
@Override
public final int hashCode() {
 int h = hash;
 if (h == 0) {
  int size = size();
  h = partialHash(size, 0, size);
  if (h == 0) {
   h = 1;
  }
  hash = h;
 }
 return h;
}

代码示例来源:origin: yeriomin/play-store-api

@Override
protected int partialHash(int h, int offset, int length) {
 int toIndex = offset + length;
 if (toIndex <= leftLength) {
  return left.partialHash(h, offset, length);
 } else if (offset >= leftLength) {
  return right.partialHash(h, offset - leftLength, length);
 } else {
  int leftLength = this.leftLength - offset;
  int leftPartial = left.partialHash(h, offset, leftLength);
  return right.partialHash(leftPartial, 0, length - leftLength);
 }
}

代码示例来源:origin: com.google.protobuf/protobuf-lite

@Override
protected int partialHash(int h, int offset, int length) {
 int toIndex = offset + length;
 if (toIndex <= leftLength) {
  return left.partialHash(h, offset, length);
 } else if (offset >= leftLength) {
  return right.partialHash(h, offset - leftLength, length);
 } else {
  int leftLength = this.leftLength - offset;
  int leftPartial = left.partialHash(h, offset, leftLength);
  return right.partialHash(leftPartial, 0, length - leftLength);
 }
}

代码示例来源:origin: WeAreFairphone/FP2-Launcher

@Override
protected int partialHash(int h, int offset, int length) {
 int toIndex = offset + length;
 if (toIndex <= leftLength) {
  return left.partialHash(h, offset, length);
 } else if (offset >= leftLength) {
  return right.partialHash(h, offset - leftLength, length);
 } else {
  int leftLength = this.leftLength - offset;
  int leftPartial = left.partialHash(h, offset, leftLength);
  return right.partialHash(leftPartial, 0, length - leftLength);
 }
}

代码示例来源:origin: yeriomin/play-store-api

/**
 * Compute the hashCode using the traditional algorithm from {@link
 * ByteString}.
 *
 * @return hashCode value
 */
@Override
public final int hashCode() {
 int h = hash;
 if (h == 0) {
  int size = size();
  h = partialHash(size, 0, size);
  if (h == 0) {
   h = 1;
  }
  hash = h;
 }
 return h;
}

代码示例来源:origin: com.google.protobuf/protobuf-lite

/**
 * Compute the hashCode using the traditional algorithm from {@link
 * ByteString}.
 *
 * @return hashCode value
 */
@Override
public final int hashCode() {
 int h = hash;
 if (h == 0) {
  int size = size();
  h = partialHash(size, 0, size);
  if (h == 0) {
   h = 1;
  }
  hash = h;
 }
 return h;
}

相关文章