Package jetbrains.buildServer.util
Class Interval<T extends Comparable<T>>
- java.lang.Object
-
- jetbrains.buildServer.util.Interval<T>
-
public class Interval<T extends Comparable<T>> extends Object
Generic interval. Hold a couple of values A and B, where A <= B.Both bounds are inclusive.
Value object.
- Since:
- 9.0
- Author:
- Leonid Bushuev
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(T x)
Checks whether the given value is in the interval (both interval bounds are inclusive).boolean
equals(Object o)
T
getBegin()
Getter forbegin
to allow using it in JSP.T
getEnd()
Getter forend
to allow using it in JSP.int
hashCode()
static <T extends Comparable<T>>
Interval<T>of(T beginAndEnd)
Returns an interval of the one given value.static <T extends Comparable<T>>
Interval<T>of(T begin, T end)
Returns an interval of the given values.String
toString()
-
-
-
Field Detail
-
begin
@NotNull public final T extends Comparable<T> begin
The left bound of the interval.
-
end
@NotNull public final T extends Comparable<T> end
The right bound of the interval.
-
-
Method Detail
-
of
@NotNull public static <T extends Comparable<T>> Interval<T> of(@NotNull T begin, @NotNull T end)
Returns an interval of the given values.- Parameters:
begin
- the begin/left border (inlcusive).end
- the end/right border (inlcusive).- Returns:
- interval.
-
of
@NotNull public static <T extends Comparable<T>> Interval<T> of(@NotNull T beginAndEnd)
Returns an interval of the one given value.- Parameters:
beginAndEnd
- both borders.- Returns:
- interval.
-
contains
public final boolean contains(@NotNull T x)
Checks whether the given value is in the interval (both interval bounds are inclusive).- Parameters:
x
- value to check.- Returns:
- true if the given value is in the interval.
-
getBegin
@NotNull public final T getBegin()
Getter forbegin
to allow using it in JSP.- Returns:
- the left bound of the interval.
- See Also:
begin
-
getEnd
@NotNull public final T getEnd()
Getter forend
to allow using it in JSP.- Returns:
- the right bound of the interval.
- See Also:
end
-
-