public final class Interval<NUMBER_TYPE extends java.lang.Number>
extends java.lang.Object
Constructor and Description |
---|
Interval(NUMBER_TYPE leftBoundary,
boolean leftOpen,
NUMBER_TYPE rightBoundary,
boolean rightOpen) |
Interval(NUMBER_TYPE leftBoundary,
NUMBER_TYPE rightBoundary) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(NUMBER_TYPE number)
Checks if a number is contained in an interval
|
NUMBER_TYPE |
getLeftBoundary() |
NUMBER_TYPE |
getRightBoundary() |
Interval<NUMBER_TYPE> |
intersect(Interval<NUMBER_TYPE> interval)
Calculates the intersection of this interval and the given interval
If the intersection is the empty interval, null will be returned
|
boolean |
isLeftOpen() |
boolean |
isRightOpen() |
java.lang.String |
toString() |
Interval<NUMBER_TYPE> |
union(Interval<NUMBER_TYPE> interval)
Calculates the union of this interval and the given interval
If the union can not be calculated, e.g. its not a single interval, null will be returned
|
public Interval(NUMBER_TYPE leftBoundary, NUMBER_TYPE rightBoundary)
public Interval(NUMBER_TYPE leftBoundary, boolean leftOpen, NUMBER_TYPE rightBoundary, boolean rightOpen)
public NUMBER_TYPE getLeftBoundary()
public boolean isLeftOpen()
public NUMBER_TYPE getRightBoundary()
public boolean isRightOpen()
public Interval<NUMBER_TYPE> intersect(Interval<NUMBER_TYPE> interval)
interval
- The interval to intersect withpublic Interval<NUMBER_TYPE> union(Interval<NUMBER_TYPE> interval)
interval
- The interval to calculate the union withpublic boolean contains(NUMBER_TYPE number)
number
- The number to checkpublic java.lang.String toString()
toString
in class java.lang.Object
Siehe auch Jowidgets Nutzerhandbuch