cdm/src/main/java/ucar/ma2/Range.java
public Range union(Range r) throws InvalidRangeException {
    if (length() == 0)
      return r;
    if (this == VLEN || r == VLEN)
      return VLEN;

    if (r.length() == 0)
      return this;

    int first = Math.min(this.first(), r.first());
    int last = Math.max(this.last(), r.last());
    return new Range(name, first, last);
  }
public Range union(Range r) throws InvalidRangeException {
    if (length() == 0)
      return r;
    if (this == VLEN || r == VLEN)
      return VLEN;

    if (r.length() == 0)
      return this;

    int first = Math.min(this.first(), r.first());
    int last = Math.max(this.last(), r.last());
    return new Range(name, first, last);
  }
Create a new Range by making the union with a Range using same interval as this Range.
NOTE: no strides

@param r range to add
@return intersected Range, may be EMPTY
@throws InvalidRangeException elements must be nonnegative