Interface ConnectedRange<Range_,Point_ extends Comparable<Point_>,Difference_ extends Comparable<Difference_>>
- Type Parameters:
Range_- The type of range in the collection.Point_- The type of the start and end points for each range.Difference_- The type of difference between start and end points.
- All Superinterfaces:
Iterable<Range_>
public interface ConnectedRange<Range_,Point_ extends Comparable<Point_>,Difference_ extends Comparable<Difference_>>
extends Iterable<Range_>
Represents a collection of ranges that are connected, meaning
the union of all the ranges results in the range
[
getStart(), getEnd()) without gaps.-
Method Summary
Modifier and TypeMethodDescriptionintGet the number of ranges contained by thisConnectedRange.@NonNull Point_getEnd()Gets the last end point represented by thisConnectedRange.@NonNull Difference_Get the length of thisConnectedRange.intGet the maximum number of overlapping ranges for any point contained by thisConnectedRange.intGet the minimum number of overlapping ranges for any point contained by thisConnectedRange.@NonNull Point_getStart()Gets the first start point represented by thisConnectedRange.booleanTrue if thisConnectedRangehas at least one pair of ranges that overlaps each other, false otherwise.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getContainedRangeCount
int getContainedRangeCount()Get the number of ranges contained by thisConnectedRange.- Returns:
- the number of ranges contained by this
ConnectedRange.
-
hasOverlap
boolean hasOverlap()True if thisConnectedRangehas at least one pair of ranges that overlaps each other, false otherwise.- Returns:
- true iff there at least one pair of overlapping ranges in this
ConnectedRange.
-
getMinimumOverlap
int getMinimumOverlap()Get the minimum number of overlapping ranges for any point contained by thisConnectedRange.- Returns:
- the minimum number of overlapping ranges for any point
in this
ConnectedRange.
-
getMaximumOverlap
int getMaximumOverlap()Get the maximum number of overlapping ranges for any point contained by thisConnectedRange.- Returns:
- the maximum number of overlapping ranges for any point
in this
ConnectedRange.
-
getLength
@NonNull Difference_ getLength()Get the length of thisConnectedRange.- Returns:
- The difference between
getEnd()andgetStart().
-
getStart
@NonNull Point_ getStart()Gets the first start point represented by thisConnectedRange.- Returns:
- never null, the first start point represented by this
ConnectedRange.
-
getEnd
@NonNull Point_ getEnd()Gets the last end point represented by thisConnectedRange.- Returns:
- the last end point represented by this
ConnectedRange.
-