/** * Create a new Section by union with another Section * * @param other Section other section * @return new Section, union of the two * @throws InvalidRangeException if want.getRank() not equal to this.getRank(), or invalid component Range */ public Section union(Section other) throws InvalidRangeException { if (other.getRank() != getRank()) throw new InvalidRangeException("Invalid Section rank"); List<Range> results = new ArrayList<Range>(getRank()); for (int j = 0; j < list.size(); j++) { Range base = list.get(j); Range r = other.getRange(j); results.add(base.union(r)); } return new Section(results); }
/** * Create a new Section by union with another Section * * @param other Section other section * @return new Section, union of the two * @throws InvalidRangeException if want.getRank() not equal to this.getRank(), or invalid component Range */ public Section union(Section other) throws InvalidRangeException { if (other.getRank() != getRank()) throw new InvalidRangeException("Invalid Section rank"); List<Range> results = new ArrayList<>(getRank()); for (int j = 0; j < list.size(); j++) { Range base = list.get(j); Range r = other.getRange(j); results.add(base.union(r)); } return new Section(results); }
/** * Create a new Section by union with another Section * * @param other Section other section * @return new Section, union of the two * @throws InvalidRangeException if want.getRank() not equal to this.getRank(), or invalid component Range */ public Section union(Section other) throws InvalidRangeException { if (other.getRank() != getRank()) throw new InvalidRangeException("Invalid Section rank"); List<Range> results = new ArrayList<>(getRank()); for (int j = 0; j < list.size(); j++) { Range base = list.get(j); Range r = other.getRange(j); results.add(base.union(r)); } return new Section(results); }