Class Ranges

java.lang.Object
org.dishevelled.bio.range.Ranges

public final class Ranges extends Object
Utility methods on ranges.
Author:
Michael Heuer
  • Method Summary

    Modifier and Type
    Method
    Description
    static <C extends Comparable>
    C
    center(com.google.common.collect.Range<C> range)
    Return the center of the specified range.
    static <C extends Comparable>
    boolean
    intersect(com.google.common.collect.Range<C> range0, com.google.common.collect.Range<C> range1)
    Return true if the specified ranges intersect.
    static <C extends Comparable>
    boolean
    isGreaterThan(com.google.common.collect.Range<C> range, C value)
    Return true if the specified range is strictly greater than the specified value.
    static <C extends Comparable>
    boolean
    isLessThan(com.google.common.collect.Range<C> range, C value)
    Return true if the specified range is strictly less than the specified value.
    static <C extends Comparable>
    com.google.common.collect.Ordering<com.google.common.collect.Range<C>>
    Return an ordering by lower endpoint over ranges.
    static <C extends Comparable>
    com.google.common.collect.Ordering<com.google.common.collect.Range<C>>
    Return an ordering by upper endpoint over ranges.
    static <C extends Comparable>
    com.google.common.collect.Ordering<com.google.common.collect.Range<C>>
    Return a reverse ordering by lower endpoint over ranges.
    static <C extends Comparable>
    com.google.common.collect.Ordering<com.google.common.collect.Range<C>>
    Return a reverse ordering by upper endpoint over ranges.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • center

      public static <C extends Comparable> C center(com.google.common.collect.Range<C> range)
      Return the center of the specified range.
      Type Parameters:
      C - range endpoint type
      Parameters:
      range - range, must not be null
      Returns:
      the center of the specified range
    • intersect

      public static <C extends Comparable> boolean intersect(com.google.common.collect.Range<C> range0, com.google.common.collect.Range<C> range1)
      Return true if the specified ranges intersect.
      Type Parameters:
      C - range endpoint type
      Parameters:
      range0 - first range, must not be null
      range1 - second range, must not be null
      Returns:
      true if the specified ranges intersect
    • isLessThan

      public static <C extends Comparable> boolean isLessThan(com.google.common.collect.Range<C> range, C value)
      Return true if the specified range is strictly less than the specified value.
      Type Parameters:
      C - range endpoint type
      Parameters:
      range - range, must not be null
      value - value, must not be null
      Returns:
      true if the specified range is strictly less than the specified value
    • isGreaterThan

      public static <C extends Comparable> boolean isGreaterThan(com.google.common.collect.Range<C> range, C value)
      Return true if the specified range is strictly greater than the specified value.
      Type Parameters:
      C - range endpoint type
      Parameters:
      range - range, must not be null
      value - value, must not be null
      Returns:
      true if the specified range is strictly greater than the specified value
    • orderingByLowerEndpoint

      public static <C extends Comparable> com.google.common.collect.Ordering<com.google.common.collect.Range<C>> orderingByLowerEndpoint()
      Return an ordering by lower endpoint over ranges.
      Type Parameters:
      C - range endpoint type
      Returns:
      an ordering by lower endpoint over ranges
    • reverseOrderingByLowerEndpoint

      public static <C extends Comparable> com.google.common.collect.Ordering<com.google.common.collect.Range<C>> reverseOrderingByLowerEndpoint()
      Return a reverse ordering by lower endpoint over ranges.
      Type Parameters:
      C - range endpoint type
      Returns:
      a reverse ordering by lower endpoint over ranges
    • orderingByUpperEndpoint

      public static <C extends Comparable> com.google.common.collect.Ordering<com.google.common.collect.Range<C>> orderingByUpperEndpoint()
      Return an ordering by upper endpoint over ranges.
      Type Parameters:
      C - range endpoint type
      Returns:
      an ordering by upper endpoint over ranges
    • reverseOrderingByUpperEndpoint

      public static <C extends Comparable> com.google.common.collect.Ordering<com.google.common.collect.Range<C>> reverseOrderingByUpperEndpoint()
      Return a reverse ordering by upper endpoint over ranges.
      Type Parameters:
      C - range endpoint type
      Returns:
      a reverse ordering by upper endpoint over ranges