Class SqlParserPos

  • All Implemented Interfaces:
    java.io.Serializable

    public class SqlParserPos
    extends java.lang.Object
    implements java.io.Serializable
    SqlParserPos represents the position of a parsed token within SQL statement text.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SqlParserPos​(int lineNumber, int columnNumber)
      Creates a new parser position.
      SqlParserPos​(int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber)
      Creates a new parser range.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean endsAfter​(SqlParserPos pos)  
      boolean equals​(java.lang.Object o)  
      int getColumnNum()  
      int getEndColumnNum()  
      int getEndLineNum()  
      int getLineNum()  
      int hashCode()  
      boolean overlaps​(SqlParserPos pos)  
      SqlParserPos plus​(SqlParserPos pos)
      Combines this parser position with another to create a position that spans from the first point in the first to the last point in the other.
      SqlParserPos plusAll​(java.util.Collection<SqlNode> nodeList)
      Combines this parser position with a list of positions.
      SqlParserPos plusAll​(SqlNode[] nodes)
      Combines this parser position with an array of positions to create a position that spans from the first point in the first to the last point in the other.
      boolean startsAt​(SqlParserPos pos)  
      private boolean startsBefore​(SqlParserPos pos)  
      static SqlParserPos sum​(java.lang.Iterable<SqlParserPos> poses)
      Combines an iterable of parser positions to create a position which spans from the beginning of the first to the end of the last.
      private static SqlParserPos sum​(java.lang.Iterable<SqlParserPos> poses, int line, int column, int endLine, int endColumn)
      Computes the parser position which is the sum of an array of parser positions and of a parser position represented by (line, column, endLine, endColumn).
      static SqlParserPos sum​(java.util.List<? extends SqlNode> nodes)
      Combines the parser positions of a list of nodes to create a position which spans from the beginning of the first to the end of the last.
      static SqlParserPos sum​(SqlNode[] nodes)
      Combines the parser positions of an array of nodes to create a position which spans from the beginning of the first to the end of the last.
      private static SqlParserPos sum_​(java.util.List<SqlParserPos> positions)
      Combines a list of parser positions to create a position which spans from the beginning of the first to the end of the last.
      private static java.lang.Iterable<SqlParserPos> toPos​(java.lang.Iterable<SqlNode> nodes)  
      private static java.util.List<SqlParserPos> toPos​(SqlNode[] nodes)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • ZERO

        public static final SqlParserPos ZERO
        SqlParserPos representing line one, character one. Use this if the node doesn't correspond to a position in piece of SQL text.
      • lineNumber

        private final int lineNumber
      • columnNumber

        private final int columnNumber
      • endLineNumber

        private final int endLineNumber
      • endColumnNumber

        private final int endColumnNumber
    • Constructor Detail

      • SqlParserPos

        public SqlParserPos​(int lineNumber,
                            int columnNumber)
        Creates a new parser position.
      • SqlParserPos

        public SqlParserPos​(int startLineNumber,
                            int startColumnNumber,
                            int endLineNumber,
                            int endColumnNumber)
        Creates a new parser range.
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • getLineNum

        public int getLineNum()
        Returns:
        1-based starting line number
      • getColumnNum

        public int getColumnNum()
        Returns:
        1-based starting column number
      • getEndLineNum

        public int getEndLineNum()
        Returns:
        1-based end line number (same as starting line number if the ParserPos is a point, not a range)
      • getEndColumnNum

        public int getEndColumnNum()
        Returns:
        1-based end column number (same as starting column number if the ParserPos is a point, not a range)
      • toString

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

        public SqlParserPos plus​(SqlParserPos pos)
        Combines this parser position with another to create a position that spans from the first point in the first to the last point in the other.
      • plusAll

        public SqlParserPos plusAll​(SqlNode[] nodes)
        Combines this parser position with an array of positions to create a position that spans from the first point in the first to the last point in the other.
      • plusAll

        public SqlParserPos plusAll​(java.util.Collection<SqlNode> nodeList)
        Combines this parser position with a list of positions.
      • sum

        public static SqlParserPos sum​(SqlNode[] nodes)
        Combines the parser positions of an array of nodes to create a position which spans from the beginning of the first to the end of the last.
      • toPos

        private static java.lang.Iterable<SqlParserPos> toPos​(java.lang.Iterable<SqlNode> nodes)
      • sum

        public static SqlParserPos sum​(java.util.List<? extends SqlNode> nodes)
        Combines the parser positions of a list of nodes to create a position which spans from the beginning of the first to the end of the last.
      • sum

        public static SqlParserPos sum​(java.lang.Iterable<SqlParserPos> poses)
        Combines an iterable of parser positions to create a position which spans from the beginning of the first to the end of the last.
      • sum_

        private static SqlParserPos sum_​(java.util.List<SqlParserPos> positions)
        Combines a list of parser positions to create a position which spans from the beginning of the first to the end of the last.
      • sum

        private static SqlParserPos sum​(java.lang.Iterable<SqlParserPos> poses,
                                        int line,
                                        int column,
                                        int endLine,
                                        int endColumn)
        Computes the parser position which is the sum of an array of parser positions and of a parser position represented by (line, column, endLine, endColumn).
        Parameters:
        poses - Array of parser positions
        line - Start line
        column - Start column
        endLine - End line
        endColumn - End column
        Returns:
        Sum of parser positions
      • startsBefore

        private boolean startsBefore​(SqlParserPos pos)
      • endsAfter

        private boolean endsAfter​(SqlParserPos pos)