Class LineSet


  • public class LineSet
    extends java.lang.Object
    Represents a set of lines.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.SortedMap<java.lang.Integer,​java.lang.Integer> lines
      Maps line numbers to their start column.
    • Constructor Summary

      Constructors 
      Constructor Description
      LineSet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLineAndCol​(int lineNum, int col)
      Add a line to this set of lines.
      int firstLine()
      Get the line number of the first line.
      int firstLineCol()
      Get the starting column for the first line.
      java.lang.Integer getStartColumn​(java.lang.Integer lineNum)
      Get the starting column for a given line number.
      boolean isEmpty()
      Determines if this set of lines is empty.
      int lastLine()
      Get the line number of the last line.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • lines

        private final java.util.SortedMap<java.lang.Integer,​java.lang.Integer> lines
        Maps line numbers to their start column.
    • Constructor Detail

      • LineSet

        public LineSet()
    • Method Detail

      • getStartColumn

        public java.lang.Integer getStartColumn​(java.lang.Integer lineNum)
        Get the starting column for a given line number.
        Parameters:
        lineNum - the specified line number
        Returns:
        the starting column for the given line number
      • firstLineCol

        public int firstLineCol()
        Get the starting column for the first line.
        Returns:
        the starting column for the first line.
      • firstLine

        public int firstLine()
        Get the line number of the first line.
        Returns:
        the line number of the first line
      • lastLine

        public int lastLine()
        Get the line number of the last line.
        Returns:
        the line number of the last line
      • addLineAndCol

        public void addLineAndCol​(int lineNum,
                                  int col)
        Add a line to this set of lines.
        Parameters:
        lineNum - the line to add
        col - the starting column of the new line
      • isEmpty

        public boolean isEmpty()
        Determines if this set of lines is empty.
        Returns:
        true if it is empty, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object