積集合部のみにする

@param ranges Rangeコレクション
334782
public void intersect(Collection<? extends Range> ranges) {
		Ranges targetRanges;
		if (ranges instanceof Ranges) {
			targetRanges = (Ranges) ranges;
		} else {
			targetRanges = new Ranges(ranges);
		}

		List<Range> newList = new ArrayList<>();
		for (Iterator<? extends Range> iterator = this.ranges.iterator(); iterator.hasNext();) {
			Range r = iterator.next();
			List<Range> hasIntersections = getHasIntersections(targetRanges, r);
			if (hasIntersections.isEmpty()) {
				iterator.remove();
			} else {
				if (hasIntersections.size() == 1) {
					Range target = hasIntersections.get(0);
					if (r.equals(target)) {
						continue;
					}
				}
				iterator.remove();
				for (Range rangeHasIntersection : hasIntersections) {
					newList.add(rangeHasIntersection.intersection(r));
				}
			}
		}
		addAll(newList);
	}
302671
@SuppressWarnings("unchecked")
    public static List<Byte> getAt(byte[] array, ObjectRange range) {
        return primitiveArrayGet(array, range);
    }
201317
public List<InetAddress> getEndpoint(Range<Token> range)
    {
        return (List<InetAddress>) rangeMap.get(range);
    }
996141
public static <C extends Comparable> RangeTree<C> create(final Iterable<Range<C>> ranges) {
        return new CenteredRangeTree<C>(ranges);
    }
1200919
protected void compactRanges() {
		boolean DEBUG = false;
		if (this.ranges == null || this.ranges.length <= 2)
			return;
		if (this.isCompacted())
			return;
		int base = 0; // Index of writing point
		int target = 0; // Index of processing point

		while (target < this.ranges.length) {
			if (base != target) {
				this.ranges[base] = this.ranges[target++];
				this.ranges[base + 1] = this.ranges[target++];
			} else
				target += 2;
			int baseend = this.ranges[base + 1];
			while (target < this.ranges.length) {
				if (baseend + 1 < this.ranges[target])
					break;
				if (baseend + 1 == this.ranges[target]) {
					if (DEBUG)
						System.err
								.println("Token#compactRanges(): Compaction: ["
										+ this.ranges[base] + ", "
										+ this.ranges[base + 1] + "], ["
										+ this.ranges[target] + ", "
										+ this.ranges[target + 1] + "] -> ["
										+ this.ranges[base] + ", "
										+ this.ranges[target + 1] + "]");
					this.ranges[base + 1] = this.ranges[target + 1];
					baseend = this.ranges[base + 1];
					target += 2;
				} else if (baseend >= this.ranges[target + 1]) {
					if (DEBUG)
						System.err
								.println("Token#compactRanges(): Compaction: ["
										+ this.ranges[base] + ", "
										+ this.ranges[base + 1] + "], ["
										+ this.ranges[target] + ", "
										+ this.ranges[target + 1] + "] -> ["
										+ this.ranges[base] + ", "
										+ this.ranges[base + 1] + "]");
					target += 2;
				} else if (baseend < this.ranges[target + 1]) {
					if (DEBUG)
						System.err
								.println("Token#compactRanges(): Compaction: ["
										+ this.ranges[base] + ", "
										+ this.ranges[base + 1] + "], ["
										+ this.ranges[target] + ", "
										+ this.ranges[target + 1] + "] -> ["
										+ this.ranges[base] + ", "
										+ this.ranges[target + 1] + "]");
					this.ranges[base + 1] = this.ranges[target + 1];
					baseend = this.ranges[base + 1];
					target += 2;
				} else {
					throw new RuntimeException(
							"Token#compactRanges(): Internel Error: ["
									+ this.ranges[base] + ","
									+ this.ranges[base + 1] + "] ["
									+ this.ranges[target] + ","
									+ this.ranges[target + 1] + "]");
				}
			} // while
			base += 2;
		}

		if (base != this.ranges.length) {
			int[] result = new int[base];
			System.arraycopy(this.ranges, 0, result, 0, base);
			this.ranges = result;
		}
		this.setCompacted();
	}
490882
public static List<Range> union(List<Range> ranges){
        ranges = new ArrayList<Range>(ranges);
        Collections.sort(ranges, new Comparator<Range>(){
            @Override
            public int compare(Range r1, Range r2){
                return r1.min-r2.min;
            }
        });
        List<Range> union = new ArrayList<Range>();
        for(Range r: ranges){
            if(union.isEmpty())
                union.add(r);
            else
                CollectionUtil.addAll(union, union.remove(union.size() - 1).union(r));
        }
        return union;
    }
1329729
private void handleRange(final String range) {

		final String[] parts = range.split("[\\-]+");
		switch (parts.length) {

			case 1:
				// no range
				final Integer singleNumber = toInt(parts[0]);
				if (singleNumber != null) {

					ranges.add(new Range(singleNumber, singleNumber));
				}
				break;

			case 2:
				// valid range
				final Integer first = toInt(parts[0]);
				final Integer last  = toInt(parts[1]);

				if (first != null && last != null) {

					ranges.add(new Range(first, last));

				} else {

					throw new IllegalArgumentException("Range must have two boundaries");
				}
				break;

			default:
				logger.warn("Invalid range specification, unable to parse {}, ignoring.", range);
		}
	}
268922
public static CellRangeAddress mergeCells(final Sheet sheet, int startCol, int startRow, int endCol, int endRow) {
        ArgUtils.notNull(sheet, "sheet");

        // 結合先のセルの値を空に設定する
        for(int r=startRow; r <= endRow; r++) {
            for(int c=startCol; c <= endCol; c++) {

                if(r == startRow && c == startCol) {
                    continue;
                }

                Cell cell = getCell(sheet, c, r);
                cell.setCellType(CellType.BLANK);
            }
        }

        final CellRangeAddress range = new CellRangeAddress(startRow, endRow, startCol, endCol);
        sheet.addMergedRegion(range);
        return range;
    }
931752
public static void parse(final String range, final RangeConfig tc) throws RangeException {
        if (range == null) {
            throw new RangeException("Range can't be null");
        }
        ROOT_STAGE.parse(range, tc);
        checkBoundaries(tc);
    }
449399
public void setRange(String range) {
        String single = range.trim();
        int hyphenIndex = range.indexOf('-');

        if (hyphenIndex > 0) {
            this.start = rangeSingle(range.substring(0, hyphenIndex));
            this.end = rangeSingle(range.substring(hyphenIndex + 1));
        } else {
            int number = rangeSingle(range);
            if (number >= 0) { // first n attributes
                this.start = 0;
                this.end = number;
            } else { // last n attributes
                this.start = this.upperLimit + number > 0 ? this.upperLimit + number : 0;
                this.end = this.upperLimit - 1;
            }
        }
    }
207395
public static LongStream rangeValues(Protos.Value.Range range) {
		checkNotNull(range);
		return LongStream.rangeClosed(range.getBegin(), range.getEnd());
	}
116034
@Override
  public Collection<Range<T>> rangesOverlapping(final Range<T> queryRange) {
    final ImmutableSet.Builder<Range<T>> ret = ImmutableSet.builder();
    for (final Range<T> range : ranges) {
      if (range.isConnected(queryRange) && !range.intersection(queryRange).isEmpty()) {
        ret.add(range);
      }
    }
    return ret.build();
  }
1204023
public static <E, D extends Comparable> Range<E, D> newRange(Attribute<?, ?>... fields) {
        return new Range<E, D>(fields);
    }
56252
function(sel, range) {
            var ranges = sel.getAllRanges();
            sel.removeAllRanges();
            for (var i = 0, len = ranges.length; i < len; ++i) {
                if (!rangesEqual(range, ranges[i])) {
                    sel.addRange(ranges[i]);
                }
            }
            if (!sel.rangeCount) {
                updateEmptySelection(sel);
            }
        }
723221
public boolean IsOverlapping(FloatRange range) {
        return ((isInside(range.min)) || (isInside(range.max)) ||
                (range.isInside(min)) || (range.isInside(max)));
    }
742455
function rangeExtents(ranges) {
  var start = Number.MAX_VALUE;
  var end = Number.MIN_VALUE;
  ranges.map(function (_ref) {
    var rs = _ref.start,
        re = _ref.end;

    start = Math.min(start, rs);
    end = Math.max(end, re);
  });
  return { start: start, end: end };
}
941954
@Override
  public void exitMaven_ranges(VersionParser.Maven_rangesContext ctx) {
    if (ctx.getChildCount() == 3) {
      IVersionRange r1 = (IVersionRange) stack.pop();
      IVersionRange r2 = (IVersionRange) stack.pop();
      stack.push(new OrRange(r2, r1));
    }
    else {
      if (strict) {
        throw new InvalidRangeRuntimeException("Cannot have an empty set range");
      }
    }
  }