Package org.jsoup.nodes
Class Range.Position
java.lang.Object
org.jsoup.nodes.Range.Position
- Enclosing class:
- Range
A Position object tracks the character position in the original input source where a Node starts or ends. If you want to
track these positions, tracking must be enabled in the Parser with
Parser.setTrackPosition(boolean).- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPosition(int pos, int lineNumber, int columnNumber) Create a new Position object. -
Method Summary
Modifier and TypeMethodDescriptionintGets the cursor number (1-based) of the original input source that this Position was read at.booleaninthashCode()booleanTest if this position was tracked during parsing.intGets the line number (1-based) of the original input source that this Position was read at.intpos()Gets the position index (0-based) of the original input source that this Position was read at.toString()Gets a String presentation of this Position, in the formatline,column:pos.
-
Constructor Details
-
Position
Create a new Position object. Called by the TreeBuilder if source position tracking is on.- Parameters:
pos- position indexlineNumber- line numbercolumnNumber- column number
-
-
Method Details
-
pos
Gets the position index (0-based) of the original input source that this Position was read at. This tracks the total number of characters read into the source at this position, regardless of the number of preceding lines.- Returns:
- the position, or
-1if untracked.
-
lineNumber
Gets the line number (1-based) of the original input source that this Position was read at.- Returns:
- the line number, or
-1if untracked.
-
columnNumber
Gets the cursor number (1-based) of the original input source that this Position was read at. The cursor number resets to 1 on every new line.- Returns:
- the cursor number, or
-1if untracked.
-
isTracked
Test if this position was tracked during parsing.- Returns:
- true if this was tracked during parsing, false otherwise (and all fields will be
-1).
-
toString
Gets a String presentation of this Position, in the formatline,column:pos. -
equals
-
hashCode
-