Class LineRanges


  • public final class LineRanges
    extends Object
    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 Detail

      • LineRanges

        public LineRanges()
    • Method Detail

      • add

        public void add​(LineRange line)
        Adds a line range to the collection.
        Parameters:
        line - The line range to add to the collection
      • iterator

        public Iterator<LineRange> 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

        public LineRanges within​(LineRanges ranges)
        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.