Record Class Range
java.lang.Object
java.lang.Record
io.github.treesitter.jtreesitter.Range
@NullMarked
public record Range(Point startPoint, Point endPoint, int startByte, int endByte)
extends Record
A range of positions in a text document,
both in terms of bytes and of row-column points.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEdit the range to keep it in-sync with source code that has been edited.intendByte()Returns the value of theendByterecord component.endPoint()Returns the value of theendPointrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thestartByterecord component.Returns the value of thestartPointrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Range
Creates an instance of a Range record class.- Throws:
IllegalArgumentException- IfstartPoint > endPointorstartByte > endByte.
-
-
Method Details
-
edit
Edit the range to keep it in-sync with source code that has been edited.This function updates the range's byte offset and row/column position based on an edit operation. This is useful for editing ranges without requiring a tree or node instance.
- Since:
- 0.26.0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
startPoint
Returns the value of thestartPointrecord component.- Returns:
- the value of the
startPointrecord component
-
endPoint
Returns the value of theendPointrecord component.- Returns:
- the value of the
endPointrecord component
-
startByte
Returns the value of thestartByterecord component.- Returns:
- the value of the
startByterecord component
-
endByte
Returns the value of theendByterecord component.- Returns:
- the value of the
endByterecord component
-