Return a reverse ordering by upper endpoint over ranges.

@param <C> range endpoint type
@return a reverse ordering by upper endpoint over ranges
1605
public static <C extends Comparable> Ordering<Range<C>> reverseOrderingByUpperEndpoint() {
        Ordering<Range<C>> orderingByUpperEndpoint = orderingByUpperEndpoint();
        return orderingByUpperEndpoint.reverse();
    }
425021
public static boolean inRange(Range range, double val) {
        return val >= range.min() && val <= range.max();
    }
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;
    }
1034911
public Range convertToSeq2Range(Range rangeInSeq1) {
        int from = aabs(convertToSeq2Position(rangeInSeq1.getFrom()));
        int to = aabs(convertToSeq2Position(rangeInSeq1.getTo()));

        if (from == -1 || to == -1)
            return null;

        return new Range(from, to);
    }
370124
public static RangeImpl range(
            EvaluationContext ctx,
            Range.RangeBoundary lowBoundary,
            Object lowEndPoint,
            Object highEndPoint,
            Range.RangeBoundary highBoundary) {

        Comparable left = asComparable(lowEndPoint);
        Comparable right = asComparable(highEndPoint);
        if (left == null || right == null || !compatible(left, right)) {
            ctx.notifyEvt(() -> new ASTEventBase(
                    FEELEvent.Severity.ERROR,
                    Msg.createMessage(
                            Msg.INCOMPATIBLE_TYPE_FOR_RANGE,
                            left.getClass().getSimpleName()
                    ),
                    null));
            return null;
        }
        return new RangeImpl(
                lowBoundary,
                left,
                right,
                highBoundary);
    }
657119
public IVersionRange getRange(String[] versions) throws InvalidRangeException
  {
    if (versions == null) {
      return null;
    }
    IVersionRange results = null;
    for (String version : versions) {
      IVersionRange range = getRange(version);
      if (results == null) {
        results = range;
      }
      else {
        results = new OrRange(results, range);
      }
    }
    return results;
  }
438917
def _reversePoints(points):
    
    # copy the points
    points = _copyPoints(points)
    # find the first on curve type and recycle
    # it for the last on curve type
    firstOnCurve = None
    for index, point in enumerate(points):
        if point.segmentType is not None:
            firstOnCurve = index
            break
    lastSegmentType = points[firstOnCurve].segmentType
    # reverse the points
    points = reversed(points)
    # work through the reversed remaining points
    final = []
    for point in points:
        segmentType = point.segmentType
        if segmentType is not None:
            point.segmentType = lastSegmentType
            lastSegmentType = segmentType
        final.append(point)
    # move any offcurves at the end of the points
    # to the start of the points
    _prepPointsForSegments(final)
    # done
    return final
549971
public static <OffsetType extends Offset<OffsetType>> Ordering<ScoringTypedOffsetRange<OffsetType>>
    orderByOverlapWith(final ScoringTypedOffsetRange<OffsetType> reference) {
    return new Ordering<ScoringTypedOffsetRange<OffsetType>>() {
      @Override
      public int compare(final ScoringTypedOffsetRange<OffsetType> left, final
      ScoringTypedOffsetRange<OffsetType> right) {
        final int leftIntersectionSize =
            left.offsetRange().intersection(reference.offsetRange())
                .transform(OffsetRange.lengthFunction()).or(0);
        final int rightIntersectionSize = right.offsetRange().intersection(reference.offsetRange())
            .transform(OffsetRange.lengthFunction()).or(0);

        return Ints.compare(leftIntersectionSize, rightIntersectionSize);
      }
    };
  }
723221
public boolean IsOverlapping(FloatRange range) {
        return ((isInside(range.min)) || (isInside(range.max)) ||
                (range.isInside(min)) || (range.isInside(max)));
    }
1356381
private static void reverseRange(Object[] a, int lo, int hi) {
        hi--;
        while (lo < hi) {
            Object t = a[lo];
            a[lo++] = a[hi];
            a[hi--] = t;
        }
    }
983311
public Query range(ByteStringRange range) {
    RowRange.Builder rangeBuilder = RowRange.newBuilder();

    switch (range.getStartBound()) {
      case OPEN:
        rangeBuilder.setStartKeyOpen(range.getStart());
        break;
      case CLOSED:
        rangeBuilder.setStartKeyClosed(range.getStart());
        break;
      case UNBOUNDED:
        rangeBuilder.clearStartKey();
        break;
      default:
        throw new IllegalStateException("Unknown start bound: " + range.getStartBound());
    }

    switch (range.getEndBound()) {
      case OPEN:
        rangeBuilder.setEndKeyOpen(range.getEnd());
        break;
      case CLOSED:
        rangeBuilder.setEndKeyClosed(range.getEnd());
        break;
      case UNBOUNDED:
        rangeBuilder.clearEndKey();
        break;
      default:
        throw new IllegalStateException("Unknown end bound: " + range.getEndBound());
    }

    builder.getRowsBuilder().addRowRanges(rangeBuilder.build());

    return this;
  }
58501
public Range move(int offset) {
        if (offset == 0)
            return this;
        return new Range(lower + offset, upper + offset, reversed);
    }
485305
private void reverseRange(Buffer a, int lo, int hi) {
    hi--;
    while (lo < hi) {
      s.swap(a, lo, hi);
      lo++;
      hi--;
    }
  }
520214
public Range getRange() {
    Long rangeMin = getRangeMin();
    Long rangeMax = getRangeMax();
    return rangeMin != null || rangeMax != null ? new Range(rangeMin, rangeMax) : null;
  }
880483
public boolean IsOverlapping(DoubleRange range) {
        return ((isInside(range.min)) || (isInside(range.max)) ||
                (range.isInside(min)) || (range.isInside(max)));
    }
61704
@Override
  public IVersionRange invert() {
    if (ranges.size() == 2) {
      IVersionRange irange1 = ranges.first().invert();
      IVersionRange irange2 = ranges.last().invert();
      return new AndRange(irange1, irange2);
    }

    throw new UnsupportedOperationException();
  }
1098084
public synchronized List<Message> getFromRange(final int startPosition, final int endPosition) {
        // cache this here, so all parts of the method operate on the same data
        final int firstMessageId = this.getFirstPosition();
        // input validation
        if ((startPosition < MessageStore.INITIAL_MESSAGE_POSITION)
                || (endPosition < MessageStore.INITIAL_MESSAGE_POSITION)) {
            throw new IllegalArgumentException("Message position cannot be negative.");
        } else if ((firstMessageId >= MessageStore.INITIAL_MESSAGE_POSITION) && (startPosition < firstMessageId)) {
            throw new IllegalArgumentException("Message at position " + startPosition
                    + " had already been discarded. First available message position is " + firstMessageId + ".");
        } else if (endPosition <= startPosition) {
            throw new IllegalArgumentException("Ending position must be larger than starting message position.");
        } else if (endPosition > this.getNextPosition()) {
            throw new IllegalArgumentException("Range end cannot be greater than the next message position.");
        }
        // and properly synchronized range retrieval
        return Collections.unmodifiableList(new LinkedList<>(this.store.subMap(startPosition, endPosition)
                .values()));
    }