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.
    • Constructor Detail

      • LineRanges

        public LineRanges()
    • Method Detail

      • add

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

        public Iterator<LineRange> iterator()
        Returns an iterator for this collection.
        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.
        line - The given line number to check
        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.
        ranges - The ranges to filter on.
        Returns all LineRange elements that are within range.
      • clear

        public void clear()
        Clears the collection.