Package org.apache.calcite.sql.parser
Class SqlParserPos
- java.lang.Object
-
- org.apache.calcite.sql.parser.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
-
-
Field Summary
Fields Modifier and Type Field Description private int
columnNumber
private int
endColumnNumber
private int
endLineNumber
private int
lineNumber
private static long
serialVersionUID
static SqlParserPos
ZERO
SqlParserPos representing line one, character one.
-
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()
-
-
-
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.
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
lineNumber
private final int lineNumber
-
columnNumber
private final int columnNumber
-
endLineNumber
private final int endLineNumber
-
endColumnNumber
private final int endColumnNumber
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.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 classjava.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.util.List<SqlParserPos> toPos(SqlNode[] nodes)
-
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 positionsline
- Start linecolumn
- Start columnendLine
- End lineendColumn
- End column- Returns:
- Sum of parser positions
-
overlaps
public boolean overlaps(SqlParserPos pos)
-
startsBefore
private boolean startsBefore(SqlParserPos pos)
-
endsAfter
private boolean endsAfter(SqlParserPos pos)
-
startsAt
public boolean startsAt(SqlParserPos pos)
-
-