io.airlift.slice.Slice.equalsUnchecked()方法的使用及代码示例

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

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

Slice.equalsUnchecked介绍

暂无

代码示例

代码示例来源:origin: io.airlift/slice

/**
 * Compares a portion of this slice with a portion of the specified slice.  Equality is
 * solely based on the contents of the slice.
 */
@SuppressWarnings("ObjectEquality")
public boolean equals(int offset, int length, Slice that, int otherOffset, int otherLength)
{
  if (length != otherLength) {
    return false;
  }
  if ((this == that) && (offset == otherOffset)) {
    return true;
  }
  checkIndexLength(offset, length);
  that.checkIndexLength(otherOffset, otherLength);
  return equalsUnchecked(offset, that, otherOffset, length);
}

代码示例来源:origin: airlift/slice

/**
 * Compares a portion of this slice with a portion of the specified slice.  Equality is
 * solely based on the contents of the slice.
 */
@SuppressWarnings("ObjectEquality")
public boolean equals(int offset, int length, Slice that, int otherOffset, int otherLength)
{
  if (length != otherLength) {
    return false;
  }
  if ((this == that) && (offset == otherOffset)) {
    return true;
  }
  checkIndexLength(offset, length);
  that.checkIndexLength(otherOffset, otherLength);
  return equalsUnchecked(offset, that, otherOffset, length);
}

代码示例来源:origin: airlift/slice

/**
 * Compares the specified object with this slice for equality.  Equality is
 * solely based on the contents of the slice.
 */
@Override
public boolean equals(Object o)
{
  if (this == o) {
    return true;
  }
  if (!(o instanceof Slice)) {
    return false;
  }
  Slice that = (Slice) o;
  if (length() != that.length()) {
    return false;
  }
  return equalsUnchecked(0, that, 0, length());
}

代码示例来源:origin: io.airlift/slice

/**
 * Compares the specified object with this slice for equality.  Equality is
 * solely based on the contents of the slice.
 */
@Override
public boolean equals(Object o)
{
  if (this == o) {
    return true;
  }
  if (!(o instanceof Slice)) {
    return false;
  }
  Slice that = (Slice) o;
  if (length() != that.length()) {
    return false;
  }
  return equalsUnchecked(0, that, 0, length());
}

代码示例来源:origin: airlift/slice

@Benchmark
public Object equalsUnchecked(BenchmarkData data)
    throws Throwable
{
  return data.slice1.equalsUnchecked(0, data.slice2, 0, data.slice1.length());
}

代码示例来源:origin: io.airlift/slice

@Benchmark
public Object equalsUnchecked(BenchmarkData data)
    throws Throwable
{
  return data.slice1.equalsUnchecked(0, data.slice2, 0, data.slice1.length());
}

代码示例来源:origin: airlift/slice

int indexOfBruteForce(Slice pattern, int offset)
{
  if (size == 0 || offset >= size) {
    return -1;
  }
  if (pattern.length() == 0) {
    return offset;
  }
  byte firstByte = pattern.getByteUnchecked(0);
  int lastValidIndex = size - pattern.length();
  int index = offset;
  while (true) {
    // seek to first byte match
    while (index < lastValidIndex && getByteUnchecked(index) != firstByte) {
      index++;
    }
    if (index > lastValidIndex) {
      break;
    }
    if (equalsUnchecked(index, pattern, 0, pattern.length())) {
      return index;
    }
    index++;
  }
  return -1;
}

代码示例来源:origin: io.airlift/slice

int indexOfBruteForce(Slice pattern, int offset)
{
  if (size == 0 || offset >= size) {
    return -1;
  }
  if (pattern.length() == 0) {
    return offset;
  }
  byte firstByte = pattern.getByteUnchecked(0);
  int lastValidIndex = size - pattern.length();
  int index = offset;
  while (true) {
    // seek to first byte match
    while (index < lastValidIndex && getByteUnchecked(index) != firstByte) {
      index++;
    }
    if (index > lastValidIndex) {
      break;
    }
    if (equalsUnchecked(index, pattern, 0, pattern.length())) {
      return index;
    }
    index++;
  }
  return -1;
}

代码示例来源:origin: airlift/slice

if (value == head && equalsUnchecked(index, pattern, 0, pattern.length())) {
  return index;

代码示例来源:origin: io.airlift/slice

if (value == head && equalsUnchecked(index, pattern, 0, pattern.length())) {
  return index;

相关文章