Package io.debezium.text
Class Position
java.lang.Object
io.debezium.text.Position
A class that represents the position of a particular character in terms of the lines and columns of a character sequence.
- Author:
- Randall Hauch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intstatic final PositionThe position is used when there is no content.private final intprivate final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a new position that is the addition of this position and that supplied.intcolumn()Get the 1-based column number of the character.booleaninthashCode()intindex()Get the 0-based index of this position in the content character array.intline()Get the 1-based line number of the character.toString()
-
Field Details
-
EMPTY_CONTENT_POSITION
The position is used when there is no content. -
line
private final int line -
column
private final int column -
indexInContent
private final int indexInContent
-
-
Constructor Details
-
Position
public Position(int indexInContent, int line, int column)
-
-
Method Details
-
index
public int index()Get the 0-based index of this position in the content character array.- Returns:
- the index; never negative except for the first position in an empty content.
-
column
public int column()Get the 1-based column number of the character.- Returns:
- the column number; always positive
-
line
public int line()Get the 1-based line number of the character.- Returns:
- the line number; always positive
-
equals
-
hashCode
public int hashCode() -
toString
-
add
Return a new position that is the addition of this position and that supplied.- Parameters:
position- the position to add to this object; may not be null- Returns:
- the combined position
-