public class Range
extends java.lang.Object
Parser.setTrackPosition(boolean)
.Node.sourceRange()
Modifier and Type | Class and Description |
---|---|
static class |
Range.Position
A Position object tracks the character position in the original input source where a Node starts or ends.
|
Modifier and Type | Field and Description |
---|---|
private Range.Position |
end |
private static java.lang.String |
EndRangeKey |
private static java.lang.String |
RangeKey |
private Range.Position |
start |
private static Range |
Untracked |
private static Range.Position |
UntrackedPos |
Constructor and Description |
---|
Range(Range.Position start,
Range.Position end)
Creates a new Range with start and end Positions.
|
Modifier and Type | Method and Description |
---|---|
Range.Position |
end()
Get the end position of this node.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isTracked()
Test if this source range was tracked during parsing.
|
(package private) static Range |
of(Node node,
boolean start)
Retrieves the source range for a given Node.
|
Range.Position |
start()
Get the start position of this node.
|
java.lang.String |
toString()
Gets a String presentation of this Range, in the format
line,column:pos-line,column:pos . |
void |
track(Node node,
boolean start)
Internal jsoup method, called by the TreeBuilder.
|
private final Range.Position start
private final Range.Position end
private static final java.lang.String RangeKey
private static final java.lang.String EndRangeKey
private static final Range.Position UntrackedPos
private static final Range Untracked
public Range(Range.Position start, Range.Position end)
start
- the start positionend
- the end positionpublic Range.Position start()
public Range.Position end()
public boolean isTracked()
-1
).static Range of(Node node, boolean start)
node
- the node to retrieve the position forstart
- if this is the starting range. false
for Element end tags.public void track(Node node, boolean start)
node
- the node to associate this position tostart
- if this is the starting range. false
for Element end tags.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
line,column:pos-line,column:pos
.toString
in class java.lang.Object