Package com.bayesserver
Class Interval<T extends Comparable>
- java.lang.Object
-
- com.bayesserver.Interval<T>
-
- Type Parameters:
T
- The data type used in the interval. E.g.Double
.
- All Implemented Interfaces:
Comparable<T>
public final class Interval<T extends Comparable> extends Object implements Comparable<T>
An interval, defined by a minimum and maximum with respective open or closed endpoints.
-
-
Constructor Summary
Constructors Constructor Description Interval()
Interval(T minimum, T maximum, IntervalEndPoint minimumEndPoint, IntervalEndPoint maximumEndPoint)
Initializes a new instance of an Interval.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(T value)
boolean
contains(T value)
Determines whether a value is within this interval.boolean
equals(Object obj)
T
getMaximum()
Gets the maximum interval value.IntervalEndPoint
getMaximumEndPoint()
Gets the end point type for the maximum value of the interval.T
getMinimum()
Gets the minimum interval value.IntervalEndPoint
getMinimumEndPoint()
Gets the end point type for the minimum value of the interval.int
hashCode()
void
setMaximum(T value)
Sets the maximum interval value.void
setMaximumEndPoint(IntervalEndPoint value)
Sets the end point type for the maximum value of the interval.void
setMinimum(T value)
Sets the minimum interval value.void
setMinimumEndPoint(IntervalEndPoint value)
Sets the end point type for the minimum value of the interval.String
toString()
-
-
-
Constructor Detail
-
Interval
public Interval(T minimum, T maximum, IntervalEndPoint minimumEndPoint, IntervalEndPoint maximumEndPoint)
Initializes a new instance of an Interval.- Parameters:
minimum
- The minimum value in the interval.maximum
- The maximum value in the interval.minimumEndPoint
- The end point type for the minimum value.maximumEndPoint
- The end point type for the maximum value.
-
Interval
public Interval()
-
-
Method Detail
-
getMaximum
public T getMaximum()
Gets the maximum interval value.- Returns:
- The maximum value in the interval.
-
setMaximum
public void setMaximum(T value)
Sets the maximum interval value.- Parameters:
value
- The maximum value in the interval.
-
getMaximumEndPoint
public IntervalEndPoint getMaximumEndPoint()
Gets the end point type for the maximum value of the interval.
-
setMaximumEndPoint
public void setMaximumEndPoint(IntervalEndPoint value)
Sets the end point type for the maximum value of the interval.
-
getMinimum
public T getMinimum()
Gets the minimum interval value.- Returns:
- The minimum value in the interval.
-
setMinimum
public void setMinimum(T value)
Sets the minimum interval value.- Parameters:
value
- The minimum value in the interval.
-
getMinimumEndPoint
public IntervalEndPoint getMinimumEndPoint()
Gets the end point type for the minimum value of the interval.
-
setMinimumEndPoint
public void setMinimumEndPoint(IntervalEndPoint value)
Sets the end point type for the minimum value of the interval.
-
contains
public boolean contains(T value)
Determines whether a value is within this interval.- Parameters:
value
- The value to check.- Returns:
true
if the value is contained in the interval,false
otherwise.
-
compareTo
public int compareTo(T value)
- Specified by:
compareTo
in interfaceComparable<T extends Comparable>
-
-