org.geotools.util.Range.contains()方法的使用及代码示例

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

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

Range.contains介绍

[英]Returns true if this range contains the given value. A range never contains the null value. This is consistent with the Range stating that null #getMinValue or #getMaxValue values are exclusive.
[中]如果此范围包含给定值,则返回true。范围从不包含空值。这与声明null#getMinValue或#getMaxValue值为独占值的范围一致。

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Implementation of {@link #union(Range)} to be invoked directly by subclasses. "NC" stands for
 * "No Cast" - this method do not try to cast the value to a compatible type.
 */
final Range<?> unionNC(final Range<? extends T> range) throws IllegalArgumentException {
  final Range<? extends T> union, min, max;
  min = compareMinTo(range.minValue, range.isMinIncluded ? 0 : +1) > 0 ? range : this;
  max = compareMaxTo(range.maxValue, range.isMaxIncluded ? 0 : -1) < 0 ? range : this;
  if (min == max) {
    union = min;
  } else {
    union = create(min.minValue, min.isMinIncluded, max.maxValue, max.isMaxIncluded);
  }
  assert union.contains(min) : min;
  assert union.contains(max) : max;
  return union;
}

代码示例来源:origin: geotools/geotools

/**
 * If the specified value is inside a range, returns the index of this range. Otherwise, returns
 * {@code -1}.
 *
 * @param value The value to search.
 * @return The index of the range which contains this value, or -1 if there is no such range.
 */
public int indexOfRange(final Comparable value) {
  int index = binarySearch(toArrayElement(value));
  if (index < 0) {
    // Found an insertion point. Make sure that the insertion
    // point is inside a range (i.e. before the maximum value).
    index = ~index; // Tild sign, not minus.
    if ((index & 1) == 0) {
      return -1;
    }
  }
  index /= 2; // Round toward 0 (odd index are maximum values).
  assert newRange(get(2 * index), get(2 * index + 1)).contains(value) : value;
  return index;
}

代码示例来源:origin: geotools/geotools

if (clipMax) {
      assert range.contains(this) : range;
      return newArray(0);
assert contains(subtract) : subtract;
assert !subtract.intersects(range) : subtract;
final Range<T>[] array = newArray(1);

代码示例来源:origin: org.geoserver/gs-wms

private boolean rangeFilterAccepts(Range rangeFilter, Object domainValue) {
  if (rangeFilter == null) {
    return true;
  }
  if (domainValue instanceof Range) {
    return rangeFilter.intersects((Range) domainValue);
  } else {
    return rangeFilter.contains((Comparable) domainValue);
  }
}

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Implementation of {@link #union(Range)} to be invoked directly by subclasses.
 * "NC" stands for "No Cast" - this method do not try to cast the value to a compatible type.
 */
final Range<?> unionNC(final Range<? extends T> range) throws IllegalArgumentException {
  final Range<? extends T> union, min, max;
  min = compareMinTo(range.minValue, range.isMinIncluded ? 0 : +1) > 0 ? range : this;
  max = compareMaxTo(range.maxValue, range.isMaxIncluded ? 0 : -1) < 0 ? range : this;
  if (min == max) {
    union = min;
  } else {
    union = create(min.minValue, min.isMinIncluded, max.maxValue, max.isMaxIncluded);
  }
  assert union.contains(min) : min;
  assert union.contains(max) : max;
  return union;
}

代码示例来源:origin: org.geogit/geogit-core

.contains(Long.valueOf(commit.getCommitter().getTimestamp()));
if (!applies) {
  return false;

代码示例来源:origin: org.geotools/gt-metadata

/**
 * If the specified value is inside a range, returns the index of this range.
 * Otherwise, returns {@code -1}.
 *
 * @param  value The value to search.
 * @return The index of the range which contains this value, or -1 if there is no such range.
 */
public int indexOfRange(final Comparable value) {
  int index = binarySearch(toArrayElement(value));
  if (index < 0) {
    // Found an insertion point. Make sure that the insertion
    // point is inside a range (i.e. before the maximum value).
    index = ~index; // Tild sign, not minus.
    if ((index & 1) == 0) {
      return -1;
    }
  }
  index /= 2; // Round toward 0 (odd index are maximum values).
  assert newRange(get(2*index), get(2*index+1)).contains(value) : value;
  return index;
}

代码示例来源:origin: locationtech/geogig

.contains(Long.valueOf(commit.getCommitter().getTimestamp()));
if (!applies) {
  return false;

代码示例来源:origin: org.locationtech.geogig/geogig-core

.contains(Long.valueOf(commit.getCommitter().getTimestamp()));
if (!applies) {
  return false;

代码示例来源:origin: org.geotools/gt-metadata

if (clipMax) {
      assert range.contains(this) : range;
      return newArray(0);
assert contains(subtract) : subtract;
assert !subtract.intersects(range) : subtract;
final Range<T>[] array = newArray(1);

相关文章