|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.spaceroots.mantissa.utilities.Interval
This class represents an interval on the real line.
This class allows to perform simple interval operations like point inclusion tests and intersection operations.
There is no distinction between open and closed intervals because real numbers cannot be represented exactly.
IntervalsList| Constructor Summary | |
Interval()
Build the [0, 0] interval. |
|
Interval(double a,
double b)
Build an interval with the given bounds. |
|
Interval(Interval i)
Copy-constructor. |
|
| Method Summary | |
static Interval |
add(Interval i1,
Interval i2)
Add two intervals. |
void |
addToSelf(Interval i)
Add an interval to the instance. |
boolean |
contains(double x)
Check if the interval contains a point. |
boolean |
contains(Interval i)
Check if the interval contains another interval. |
double |
getInf()
Get the lower bound of the interval. |
double |
getLength()
Get the length of the interval. |
double |
getSup()
Get the upper bound of the interval. |
static Interval |
intersection(Interval i1,
Interval i2)
Intersect two intervals. |
boolean |
intersects(Interval i)
Check if an interval intersects the instance. |
void |
intersectSelf(Interval i)
Intersects the instance with an interval. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Interval()
public Interval(double a,
double b)
The given bounds do not need to be ordered, they will be reordered by the constructor.
a - first boundb - second boundpublic Interval(Interval i)
i - interval to copy| Method Detail |
public double getInf()
public double getSup()
public double getLength()
public boolean contains(double x)
x - point to check
public boolean contains(Interval i)
i - interval to check
public boolean intersects(Interval i)
i - interval to check
public void addToSelf(Interval i)
This method expands the instance.
This operation is not a union operation. If
the instance and the interval are disjoints (i.e. if intersects(i) would return false), then
the hole between the intervals is filled in.
i - interval to add to the instance
public static Interval add(Interval i1,
Interval i2)
This operation is not a union operation. If
the intervals are disjoints (i.e. if i1.intersects(i2) would return false), then
the hole between the intervals is filled in.
i1 - first intervali2 - second interval
public void intersectSelf(Interval i)
This method reduces the instance, it could even become empty if the interval does not intersects the instance.
i - interval with which the instance should be intersected
public static Interval intersection(Interval i1,
Interval i2)
i1 - first intervali2 - second interval
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||