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 booleancontains(T x)Checks whether the given value is in the interval (both interval bounds are inclusive).booleanequals(Object o)TgetBegin()Getter forbeginto allow using it in JSP.TgetEnd()Getter forendto allow using it in JSP.inthashCode()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.StringtoString()
-
-
-
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 forbeginto allow using it in JSP.- Returns:
- the left bound of the interval.
- See Also:
begin
-
getEnd
@NotNull public final T getEnd()
Getter forendto allow using it in JSP.- Returns:
- the right bound of the interval.
- See Also:
end
-
-