|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.spaceroots.mantissa.utilities.IntervalsList
This class represents an intervals list.
An interval list represent a list of contiguous regions on the real line. All intervals of the list are disjoints to each other, they are stored in ascending order.
The class supports the main set operations like union and intersection.
Interval| Constructor Summary | |
IntervalsList()
Build an empty intervals list. |
|
IntervalsList(double a,
double b)
Build an intervals list containing only one interval. |
|
IntervalsList(Interval i)
Build an intervals list containing only one interval. |
|
IntervalsList(Interval i1,
Interval i2)
Build an intervals list containing two intervals. |
|
IntervalsList(IntervalsList list)
Copy constructor. |
|
| Method Summary | |
static IntervalsList |
add(IntervalsList list,
Interval i)
Add an intervals list and an interval. |
static IntervalsList |
add(IntervalsList list1,
IntervalsList list2)
Add two intervals lists. |
void |
addToSelf(Interval i)
Add an interval to the instance. |
void |
addToSelf(IntervalsList list)
Add an intervals list to the instance. |
boolean |
contains(double x)
Check if the list contains a point. |
boolean |
contains(Interval i)
Check if the list contains an interval. |
double |
getInf()
Get the lower bound of the list. |
Interval |
getInterval(int i)
Get an interval from the list. |
List |
getIntervals()
Get the ordered list of disjoints intervals. |
int |
getSize()
Get the number of intervals of the list. |
double |
getSup()
Get the upper bound of the list. |
static IntervalsList |
intersection(IntervalsList list,
Interval i)
Intersect a list and an interval. |
static IntervalsList |
intersection(IntervalsList list1,
IntervalsList list2)
Intersect two intervals lists. |
boolean |
intersects(Interval i)
Check if an interval intersects the instance. |
void |
intersectSelf(Interval i)
Intersects the instance and an interval. |
void |
intersectSelf(IntervalsList list)
Intersect the instance and another intervals list. |
boolean |
isConnex()
Check if the instance is connected. |
boolean |
isEmpty()
Check if the instance is empty. |
static IntervalsList |
subtract(IntervalsList list,
Interval i)
Remove an interval from a list. |
static IntervalsList |
subtract(IntervalsList list1,
IntervalsList list2)
Remove an intervals list from another one. |
void |
subtractFromSelf(Interval i)
Remove an interval from the list. |
void |
subtractFromSelf(IntervalsList list)
Remove an intervals list from the instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public IntervalsList()
public IntervalsList(double a,
double b)
a - first bound of the intervalb - second bound of the intervalpublic IntervalsList(Interval i)
i - interval
public IntervalsList(Interval i1,
Interval i2)
i1 - first intervali2 - second intervalpublic IntervalsList(IntervalsList list)
The copy operation is a deep copy: the underlying intervals are independant of the instances of the copied list.
list - intervals list to copy| Method Detail |
public boolean isEmpty()
public boolean isConnex()
An interval list is connected if it contains only one interval.
public double getInf()
public double getSup()
public int getSize()
public Interval getInterval(int i)
i - index of the interval
public List getIntervals()
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 a union operation. The number of intervals in the list can decrease if the interval fills some holes between existing intervals in the list.
i - interval to add to the instance
public static IntervalsList add(IntervalsList list,
Interval i)
list - intervals listi - interval
public void subtractFromSelf(Interval i)
This method reduces the instance. This operation is defined in terms of points set operation. As an example, if the [2, 3] interval is subtracted from the list containing only the [0, 10] interval, the result will be the [0, 2] U [3, 10] intervals list.
i - interval to remove
public static IntervalsList subtract(IntervalsList list,
Interval i)
list - intervals listi - interval to remove
public void intersectSelf(Interval i)
i - interval
public static IntervalsList intersection(IntervalsList list,
Interval i)
list - intervals listi - interval
public void addToSelf(IntervalsList list)
This method expands the instance.
This operation is a union operation. The number of intervals in the list can decrease if the list fills some holes between existing intervals in the instance.
list - intervals list to add to the instance
public static IntervalsList add(IntervalsList list1,
IntervalsList list2)
list1 - first intervals listlist2 - second intervals list
public void subtractFromSelf(IntervalsList list)
list - intervals list to remove
public static IntervalsList subtract(IntervalsList list1,
IntervalsList list2)
list1 - intervals listlist2 - intervals list to remove
public void intersectSelf(IntervalsList list)
list - list to intersect with the instance
public static IntervalsList intersection(IntervalsList list1,
IntervalsList list2)
list1 - first intervals listlist2 - second intervals list
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||