plus method

Returns the union of this and other.

Implementation

NumericExtents plus(NumericExtents other) {
  if (min <= other.min) {
    if (max >= other.max) {
      return this;
    } else {
      return NumericExtents(min, other.max);
    }
  } else {
    if (other.max >= max) {
      return other;
    } else {
      return NumericExtents(other.min, max);
    }
  }
}