Package com.qulice.checkstyle
Class LineRanges
java.lang.Object
com.qulice.checkstyle.LineRanges
Represents a set of LineRange objects. For example, an instance of this class
could represent all the line ranges for methods in a given Java source code
file.
- Since:
- 0.16
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a line range to the collection.void
clear()
Clears the collection.boolean
inRange
(int line) Detects if the given line number is within any of the line ranges.iterator()
Returns an iterator for this collection.within
(LineRanges ranges) Gets the subset of LineRanges that are within all given ranges.
-
Constructor Details
-
LineRanges
public LineRanges()
-
-
Method Details
-
add
Adds a line range to the collection.- Parameters:
line
- The line range to add to the collection
-
iterator
Returns an iterator for this collection.- Returns:
- Iterator pointing to the internal collections elements.
-
inRange
public boolean inRange(int line) Detects if the given line number is within any of the line ranges.- Parameters:
line
- The given line number to check- Returns:
- True if the given line number is within any line range.
-
within
Gets the subset of LineRanges that are within all given ranges. Does not return null; instead, returns empty range if there are no matches.- Parameters:
ranges
- The ranges to filter on.- Returns:
- Returns all LineRange elements that are within range.
-
clear
public void clear()Clears the collection.
-