Package org.dishevelled.bio.range
Class Ranges
java.lang.Object
org.dishevelled.bio.range.Ranges
Utility methods on ranges.
- Author:
- Michael Heuer
-
Method Summary
Modifier and TypeMethodDescriptionstatic <C extends Comparable>
Ccenter(com.google.common.collect.Range<C> range) Return the center of the specified range.static <C extends Comparable>
booleanintersect(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>
booleanisGreaterThan(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>
booleanisLessThan(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.
-
Method Details
-
center
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 nullrange1- 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 nullvalue- 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 nullvalue- 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
-