org.apache.commons.lang3.Range.equals()方法的使用及代码示例

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

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

Range.equals介绍

[英]Compares this range to another object to test if they are equal.
.

To be equal, the minimum and maximum values must be equal, which ignores any differences in the comparator.
[中]将此范围与另一个对象进行比较,以测试它们是否相等。
.
若要相等,最小值和最大值必须相等,这将忽略比较器中的任何差异。

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * Calculate the intersection of {@code this} and an overlapping Range.
 * @param other overlapping Range
 * @return range representing the intersection of {@code this} and {@code other} ({@code this} if equal)
 * @throws IllegalArgumentException if {@code other} does not overlap {@code this}
 * @since 3.0.1
 */
public Range<T> intersectionWith(final Range<T> other) {
  if (!this.isOverlappedBy(other)) {
    throw new IllegalArgumentException(String.format(
      "Cannot calculate intersection with non-overlapping range %s", other));
  }
  if (this.equals(other)) {
    return this;
  }
  final T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
  final T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
  return between(min, max, getComparator());
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testEqualsObject() {
  assertEquals(byteRange, byteRange);
  assertEquals(byteRange, byteRange2);
  assertEquals(byteRange2, byteRange2);
  assertTrue(byteRange.equals(byteRange));
  assertTrue(byteRange2.equals(byteRange2));
  assertTrue(byteRange3.equals(byteRange3));
  assertFalse(byteRange2.equals(byteRange3));
  assertFalse(byteRange2.equals(null));
  assertFalse(byteRange2.equals("Ni!"));
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * Calculate the intersection of {@code this} and an overlapping Range.
 * @param other overlapping Range
 * @return range representing the intersection of {@code this} and {@code other} ({@code this} if equal)
 * @throws IllegalArgumentException if {@code other} does not overlap {@code this}
 * @since 3.0.1
 */
public Range<T> intersectionWith(final Range<T> other) {
  if (!this.isOverlappedBy(other)) {
    throw new IllegalArgumentException(String.format(
      "Cannot calculate intersection with non-overlapping range %s", other));
  }
  if (this.equals(other)) {
    return this;
  }
  final T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
  final T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
  return between(min, max, getComparator());
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Calculate the intersection of {@code this} and an overlapping Range.
 * @param other overlapping Range
 * @return range representing the intersection of {@code this} and {@code other} ({@code this} if equal)
 * @throws IllegalArgumentException if {@code other} does not overlap {@code this}
 * @since 3.0.1
 */
public Range<T> intersectionWith(final Range<T> other) {
  if (!this.isOverlappedBy(other)) {
    throw new IllegalArgumentException(String.format(
      "Cannot calculate intersection with non-overlapping range %s", other));
  }
  if (this.equals(other)) {
    return this;
  }
  final T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
  final T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
  return between(min, max, getComparator());
}

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * Calculate the intersection of {@code this} and an overlapping Range.
 * @param other overlapping Range
 * @return range representing the intersection of {@code this} and {@code other} ({@code this} if equal)
 * @throws IllegalArgumentException if {@code other} does not overlap {@code this}
 * @since 3.0.1
 */
public Range<T> intersectionWith(final Range<T> other) {
  if (!this.isOverlappedBy(other)) {
    throw new IllegalArgumentException(StringUtils.simpleFormat(
      "Cannot calculate intersection with non-overlapping range %s", other));
  }
  if (this.equals(other)) {
    return this;
  }
  final T min = getComparator().compare(minimum, other.minimum) < 0 ? other.minimum : minimum;
  final T max = getComparator().compare(maximum, other.maximum) < 0 ? maximum : other.maximum;
  return between(min, max, getComparator());
}

代码示例来源:origin: de.julielab/julielab-entity-evaluator

return false;
if (comparisonType == ComparisonType.EXACT) {
  if (!offsetRange.equals(other.offsetRange))
    return false;

相关文章