Package ch.usi.si.seart.treesitter
Class Range.Builder
- java.lang.Object
-
- ch.usi.si.seart.treesitter.Range.Builder
-
- Enclosing class:
- Range
public static final class Range.Builder extends Object
Facilitates the construction ofRangeinstances. It allows for the step-by-step creation of these objects by providing methods for setting individual attributes. Input validations are performed at each build step.- Since:
- 1.12.0
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rangebuild()Builds a new range instance with the attributes specified in this builder.Range.BuilderendByte(int value)Sets the end byte offset for this range.Range.BuilderendPoint(@NotNull Point point)Sets the end point for this range.Range.BuilderstartByte(int value)Sets the start byte offset for this range.Range.BuilderstartPoint(@NotNull Point point)Sets the start point for this range.
-
-
-
Method Detail
-
startByte
public Range.Builder startByte(int value)
Sets the start byte offset for this range.- Parameters:
value- byte value offset- Returns:
- this builder
- Throws:
IllegalArgumentException- if the value is negative
-
endByte
public Range.Builder endByte(int value)
Sets the end byte offset for this range.- Parameters:
value- byte value offset- Returns:
- this builder
- Throws:
IllegalArgumentException- if the value is negative
-
startPoint
public Range.Builder startPoint(@NotNull @NotNull Point point)
Sets the start point for this range.- Parameters:
point- the point- Returns:
- this builder
- Throws:
NullPointerException- if the point isnullIllegalArgumentException- if the point has negative coordinates
-
endPoint
public Range.Builder endPoint(@NotNull @NotNull Point point)
Sets the end point for this range.- Parameters:
point- the point- Returns:
- this builder
- Throws:
NullPointerException- if the point isnullIllegalArgumentException- if the point has negative coordinates
-
build
public Range build()
Builds a new range instance with the attributes specified in this builder.- Returns:
- a new range instance
- Throws:
IllegalArgumentException- if the start byte is greater than the end byte, or if the start point is greater than the end point- See Also:
Point.compareTo(Point)
-
-