Package com.atlassian.bitbucket.comment
Record Class LineNumberRange
java.lang.Object
java.lang.Record
com.atlassian.bitbucket.comment.LineNumberRange
- Record Components:
maximum
- The inclusive upper bound of the line number rangeminimum
- The inclusive lower bound of the line number range
A data object to represent a line number range across a git diff.
- Since:
- 9.3
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(int lineNumber) Determines whether the provided line number falls within the rangefinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
int
maximum()
Returns the value of themaximum
record component.int
minimum()
Returns the value of theminimum
record component.boolean
overlaps
(LineNumberRange otherRange) Determines whether the provided line number range overlaps (shares line numbers in common) with this rangefinal String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
LineNumberRange
public LineNumberRange(int minimum, int maximum) Creates a new line number range- Parameters:
minimum
- the inclusive upper bound of the line number rangemaximum
- the inclusive lower bound of the line number range- Throws:
IllegalArgumentException
- if either arguments are less than 0, or if the range contains no elements
-
-
Method Details
-
contains
public boolean contains(int lineNumber) Determines whether the provided line number falls within the range- Parameters:
lineNumber
- a line number to check- Returns:
true
if the line number falls within the range;false
otherwise
-
isSingleLine
public boolean isSingleLine()- Returns:
true
if the line number range contains a single element;false
otherwise
-
overlaps
Determines whether the provided line number range overlaps (shares line numbers in common) with this range- Parameters:
otherRange
- the line number range to check- Returns:
true
if any elements of the provided range are shared with this range;false
otherwise
-
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 '=='. -
minimum
public int minimum()Returns the value of theminimum
record component.- Returns:
- the value of the
minimum
record component
-
maximum
public int maximum()Returns the value of themaximum
record component.- Returns:
- the value of the
maximum
record component
-