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

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

本文整理了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

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

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

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

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

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

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

  1. private boolean rangeFilterAccepts(Range rangeFilter, Object domainValue) {
  2. if (rangeFilter == null) {
  3. return true;
  4. }
  5. if (domainValue instanceof Range) {
  6. return rangeFilter.intersects((Range) domainValue);
  7. } else {
  8. return rangeFilter.contains((Comparable) domainValue);
  9. }
  10. }

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

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

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

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

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

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

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

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

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

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

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

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

相关文章