Package de.firemage.autograder.span
Record Class Span
java.lang.Object
java.lang.Record
de.firemage.autograder.span.Span
- Record Components:
start- the start of the span (inclusive)end- the end of the span (exclusive)
A span of text in a file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanend()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.booleanincludesLine(int lineNumber) intersection(Span other) booleanisEmpty()booleanisFollowedBy(Span other) booleanisInline()static SpanCreates a span which covers the entire string.relativeIntersection(Span other) relativize(Span span) Makes the given span relative to this span.start()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
of
Creates a span which covers the entire string.- Parameters:
lineNumber- the line number where the string starts (0-indexed)string- the string to span- Returns:
- a span which covers the entire string
-
isInline
public boolean isInline() -
includesLine
public boolean includesLine(int lineNumber) -
isEmpty
public boolean isEmpty() -
isFollowedBy
-
contains
-
relativize
Makes the given span relative to this span.- Parameters:
span- the span to relativize, must be contained in this span- Returns:
- the relative span
-
intersection
-
relativeIntersection
-
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 withObjects::equals(Object,Object). -
start
Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-