Class LineNumberMap


  • public class LineNumberMap
    extends java.lang.Object
    Line numbers are not held in nodes in the tree, because they are not usually needed. This class provides a map from element sequence numbers to line numbers: it is linked to the root node of the tree.
    • Constructor Summary

      Constructors 
      Constructor Description
      LineNumberMap()
      Create a LineNumberMap with an initial capacity of 200 nodes, which is expanded as necessary
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getColumnNumber​(int sequence)
      Get the column number corresponding to a given sequence number
      int getLineNumber​(int sequence)
      Get the line number corresponding to a given sequence number
      void setLineAndColumn​(int sequence, int line, int column)
      Set the line number corresponding to a given sequence number
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LineNumberMap

        public LineNumberMap()
        Create a LineNumberMap with an initial capacity of 200 nodes, which is expanded as necessary
    • Method Detail

      • setLineAndColumn

        public void setLineAndColumn​(int sequence,
                                     int line,
                                     int column)
        Set the line number corresponding to a given sequence number
        Parameters:
        sequence - the sequence number of the node
        line - the line number position of the node
        column - the column position of the node
      • getLineNumber

        public int getLineNumber​(int sequence)
        Get the line number corresponding to a given sequence number
        Parameters:
        sequence - the sequence number held in the node
        Returns:
        the corresponding line number
      • getColumnNumber

        public int getColumnNumber​(int sequence)
        Get the column number corresponding to a given sequence number
        Parameters:
        sequence - the sequence number held in the node
        Returns:
        the corresponding column number