com.facebook.presto.spi.predicate.Marker.isAdjacent()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(149)

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

Marker.isAdjacent介绍

[英]Adjacency is defined by two Markers being infinitesimally close to each other. This means they must share the same value and have adjacent Bounds.
[中]邻接是由两个相互接近的标记定义的。这意味着它们必须共享相同的值并具有相邻的边界。

代码示例

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

SortedRangeSet build()
  {
    Collections.sort(ranges, Comparator.comparing(Range::getLow));
    NavigableMap<Marker, Range> result = new TreeMap<>();
    Range current = null;
    for (Range next : ranges) {
      if (current == null) {
        current = next;
        continue;
      }
      if (current.overlaps(next) || current.getHigh().isAdjacent(next.getLow())) {
        current = current.span(next);
      }
      else {
        result.put(current.getLow(), current);
        current = next;
      }
    }
    if (current != null) {
      result.put(current.getLow(), current);
    }
    return new SortedRangeSet(type, result);
  }
}

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

boolean adjacent = entry1.getKey().isAdjacent(entry2.getKey());
boolean distanceIsOne = Math.abs(entry1.getValue() - entry2.getValue()) == 1;
assertEquals(adjacent, distanceIsOne);

代码示例来源:origin: com.facebook.presto/presto-spi

SortedRangeSet build()
  {
    Collections.sort(ranges, Comparator.comparing(Range::getLow));
    NavigableMap<Marker, Range> result = new TreeMap<>();
    Range current = null;
    for (Range next : ranges) {
      if (current == null) {
        current = next;
        continue;
      }
      if (current.overlaps(next) || current.getHigh().isAdjacent(next.getLow())) {
        current = current.span(next);
      }
      else {
        result.put(current.getLow(), current);
        current = next;
      }
    }
    if (current != null) {
      result.put(current.getLow(), current);
    }
    return new SortedRangeSet(type, result);
  }
}

相关文章