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

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

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

Slice.compareTo介绍

[英]Compares a portion of this slice with a portion of the specified slice. Equality is solely based on the contents of the slice.
[中]将此切片的一部分与指定切片的一部分进行比较。平等完全基于切片的内容。

代码示例

代码示例来源:origin: prestodb/presto

public StringStatistics(@Nullable Slice minimum, @Nullable Slice maximum, long sum)
{
  checkArgument(minimum == null || maximum == null || minimum.compareTo(maximum) <= 0, "minimum is not less than maximum");
  this.minimum = minimum;
  this.maximum = maximum;
  this.sum = sum;
}

代码示例来源:origin: prestodb/presto

@Override
public void addValue(Slice value)
{
  requireNonNull(value, "value is null");
  if (nonNullValueCount == 0) {
    checkState(minimum == null && maximum == null);
    minimum = value;
    maximum = value;
  }
  else if (minimum != null && value.compareTo(minimum) <= 0) {
    minimum = value;
  }
  else if (maximum != null && value.compareTo(maximum) >= 0) {
    maximum = value;
  }
  nonNullValueCount++;
  sum = addExact(sum, value.length());
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(BETWEEN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean between(@SqlType(StandardTypes.IPADDRESS) Slice value, @SqlType(StandardTypes.IPADDRESS) Slice min, @SqlType(StandardTypes.IPADDRESS) Slice max)
{
  return min.compareTo(value) <= 0 && value.compareTo(max) <= 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(BETWEEN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean between(@SqlType(StandardTypes.VARBINARY) Slice value, @SqlType(StandardTypes.VARBINARY) Slice min, @SqlType(StandardTypes.VARBINARY) Slice max)
{
  return min.compareTo(value) <= 0 && value.compareTo(max) <= 0;
}

代码示例来源:origin: prestodb/presto

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  return getRawSlice().compareTo(valueOffset(position) + offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: prestodb/presto

@LiteralParameters("x")
@ScalarOperator(BETWEEN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean between(@SqlType("varchar(x)") Slice value, @SqlType("varchar(x)") Slice min, @SqlType("varchar(x)") Slice max)
{
  return min.compareTo(value) <= 0 && value.compareTo(max) <= 0;
}

代码示例来源:origin: prestodb/presto

@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
  checkReadablePosition(position);
  return getRawSlice(position).compareTo(getPositionOffset(position) + offset, length, otherSlice, otherOffset, otherLength);
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(LESS_THAN_OR_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
public static boolean lessThanOrEqual(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right)
{
  return left.compareTo(right) <= 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(LESS_THAN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean lessThan(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right)
{
  return left.compareTo(right) < 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(GREATER_THAN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean greaterThan(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right)
{
  return left.compareTo(right) > 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(GREATER_THAN_OR_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
public static boolean greaterThanOrEqual(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right)
{
  return left.compareTo(right) >= 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(GREATER_THAN_OR_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
public static boolean greaterThanOrEqual(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right)
{
  return left.compareTo(right) >= 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(LESS_THAN_OR_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
public static boolean lessThanOrEqual(@SqlType(StandardTypes.VARBINARY) Slice left, @SqlType(StandardTypes.VARBINARY) Slice right)
{
  return left.compareTo(right) <= 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(GREATER_THAN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean greaterThan(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right)
{
  return left.compareTo(right) > 0;
}

代码示例来源:origin: prestodb/presto

@ScalarOperator(LESS_THAN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean lessThan(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right)
{
  return left.compareTo(right) < 0;
}

代码示例来源:origin: prestodb/presto

@LiteralParameters("x")
@ScalarOperator(LESS_THAN_OR_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
public static boolean lessThanOrEqual(@SqlType("varchar(x)") Slice left, @SqlType("varchar(x)") Slice right)
{
  return left.compareTo(right) <= 0;
}

代码示例来源:origin: prestodb/presto

@LiteralParameters("x")
@ScalarOperator(LESS_THAN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean lessThan(@SqlType("varchar(x)") Slice left, @SqlType("varchar(x)") Slice right)
{
  return left.compareTo(right) < 0;
}

代码示例来源:origin: prestodb/presto

@LiteralParameters("x")
@ScalarOperator(GREATER_THAN)
@SqlType(StandardTypes.BOOLEAN)
public static boolean greaterThan(@SqlType("varchar(x)") Slice left, @SqlType("varchar(x)") Slice right)
{
  return left.compareTo(right) > 0;
}

代码示例来源:origin: prestodb/presto

@LiteralParameters("x")
@ScalarOperator(GREATER_THAN_OR_EQUAL)
@SqlType(StandardTypes.BOOLEAN)
public static boolean greaterThanOrEqual(@SqlType("varchar(x)") Slice left, @SqlType("varchar(x)") Slice right)
{
  return left.compareTo(right) >= 0;
}

代码示例来源:origin: prestodb/presto

private static boolean filter(int position, Block discountBlock, Block shipDateBlock, Block quantityBlock)
  {
    return !shipDateBlock.isNull(position) && VARCHAR.getSlice(shipDateBlock, position).compareTo(MIN_SHIP_DATE) >= 0 &&
        !shipDateBlock.isNull(position) && VARCHAR.getSlice(shipDateBlock, position).compareTo(MAX_SHIP_DATE) < 0 &&
        !discountBlock.isNull(position) && DOUBLE.getDouble(discountBlock, position) >= 0.05 &&
        !discountBlock.isNull(position) && DOUBLE.getDouble(discountBlock, position) <= 0.07 &&
        !quantityBlock.isNull(position) && DOUBLE.getDouble(quantityBlock, position) < 24;
  }
}

相关文章