Record Class SourceRange
java.lang.Object
java.lang.Record
io.jenkins.plugins.configsplice.engine.SourceRange
- Record Components:
start- inclusive start offsetend- exclusive end offset
- All Implemented Interfaces:
Comparable<SourceRange>
A half-open
[start, end) range of char offsets into a decoded document.
Offsets are char offsets rather than byte offsets deliberately. Both Jackson and StAX
report positions against the character stream they were handed, so keeping one unit throughout
removes an entire class of conversion bug. SourceDocument owns the single decode/encode
boundary where characters become bytes again.
-
Constructor Summary
ConstructorsConstructorDescriptionSourceRange(int start, int end) Creates an instance of aSourceRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(SourceRange other) intend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlength()booleanoverlaps(SourceRange other) Returns true if this range shares at least one character position withother.intstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
length
public int length() -
overlaps
Returns true if this range shares at least one character position withother. -
compareTo
- Specified by:
compareToin interfaceComparable<SourceRange>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared with '=='. -
start
public int start()Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
public int end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-