Package org.jsoup.nodes
Class Range
- java.lang.Object
-
- org.jsoup.nodes.Range
-
public class Range extends java.lang.ObjectA Range object tracks the character positions 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 withParser.setTrackPosition(boolean).- Since:
- 1.15.2
- See Also:
Node.sourceRange()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRange.PositionA Position object tracks the character position in the original input source where a Node starts or ends.
-
Constructor Summary
Constructors Constructor Description Range(Range.Position start, Range.Position end)Creates a new Range with start and end Positions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Range.Positionend()Get the end position of this node.booleanequals(java.lang.Object o)inthashCode()booleanisTracked()Test if this source range was tracked during parsing.Range.Positionstart()Get the start position of this node.java.lang.StringtoString()Gets a String presentation of this Range, in the formatline,column:pos-line,column:pos.voidtrack(Node node, boolean start)Internal jsoup method, called by the TreeBuilder.
-
-
-
Constructor Detail
-
Range
public Range(Range.Position start, Range.Position end)
Creates a new Range with start and end Positions. Called by TreeBuilder when position tracking is on.- Parameters:
start- the start positionend- the end position
-
-
Method Detail
-
start
public Range.Position start()
Get the start position of this node.- Returns:
- the start position
-
end
public Range.Position end()
Get the end position of this node.- Returns:
- the end position
-
isTracked
public boolean isTracked()
Test if this source range was tracked during parsing.- Returns:
- true if this was tracked during parsing, false otherwise (and all fields will be
-1).
-
track
public void track(Node node, boolean start)
Internal jsoup method, called by the TreeBuilder. Tracks a Range for a Node.- Parameters:
node- the node to associate this position tostart- if this is the starting range.falsefor Element end tags.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Gets a String presentation of this Range, in the formatline,column:pos-line,column:pos.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String
-
-