public class IntervalsList extends Object
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.
Modifier and Type | Field and Description |
---|---|
static org.epics.util.time.TimeDuration |
minDuration |
Constructor and Description |
---|
IntervalsList()
Build an empty intervals list.
|
IntervalsList(IntervalsList list)
Copy constructor.
|
IntervalsList(org.epics.util.time.TimeInterval i)
Build an intervals list containing only one interval.
|
IntervalsList(org.epics.util.time.TimeInterval i1,
org.epics.util.time.TimeInterval i2)
Build an intervals list containing two intervals.
|
Modifier and Type | Method and Description |
---|---|
static IntervalsList |
add(IntervalsList list1,
IntervalsList list2)
Add two intervals lists.
|
static IntervalsList |
add(IntervalsList list,
org.epics.util.time.TimeInterval i)
Add an intervals list and an interval.
|
void |
addToSelf(IntervalsList list)
Add an intervals list to the instance.
|
void |
addToSelf(org.epics.util.time.TimeInterval i)
Add an interval to the instance.
|
boolean |
contains(org.epics.util.time.TimeInterval i)
Check if the list contains an interval.
|
boolean |
contains(org.epics.util.time.Timestamp t)
Check if the list contains a point.
|
org.epics.util.time.Timestamp |
getEnd()
Get the upper bound of the list.
|
List<org.epics.util.time.TimeInterval> |
getIntervals()
Get the ordered list of disjoints intervals.
|
int |
getSize()
Get the number of intervals of the list.
|
org.epics.util.time.Timestamp |
getStart()
Get the lower bound of the list.
|
org.epics.util.time.TimeInterval |
getTimeInterval(int i)
Get an interval from the list.
|
static IntervalsList |
intersection(IntervalsList list1,
IntervalsList list2)
Intersect two intervals lists.
|
static IntervalsList |
intersection(IntervalsList list,
org.epics.util.time.TimeInterval i)
Intersect a list and an interval.
|
boolean |
intersects(org.epics.util.time.TimeInterval i)
Check if an interval intersects the instance.
|
void |
intersectSelf(IntervalsList list)
Intersect the instance and another intervals list.
|
void |
intersectSelf(org.epics.util.time.TimeInterval i)
Intersects the instance and an interval.
|
boolean |
isConnex()
Check if the instance is connected.
|
boolean |
isEmpty()
Check if the instance is empty.
|
static IntervalsList |
subtract(IntervalsList list1,
IntervalsList list2)
Remove an intervals list from another one.
|
static IntervalsList |
subtract(IntervalsList list,
org.epics.util.time.TimeInterval i)
Remove an interval from a list.
|
void |
subtractFromSelf(IntervalsList list)
Remove an intervals list from the instance.
|
void |
subtractFromSelf(org.epics.util.time.TimeInterval i)
Remove an interval from the list.
|
public IntervalsList()
public IntervalsList(org.epics.util.time.TimeInterval i)
i
- intervalpublic IntervalsList(org.epics.util.time.TimeInterval i1, org.epics.util.time.TimeInterval 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 copypublic boolean isEmpty()
public boolean isConnex()
An interval list is connected if it contains only one interval.
public org.epics.util.time.Timestamp getStart()
public org.epics.util.time.Timestamp getEnd()
public int getSize()
public org.epics.util.time.TimeInterval getTimeInterval(int i)
i
- index of the intervalpublic List<org.epics.util.time.TimeInterval> getIntervals()
public boolean contains(org.epics.util.time.Timestamp t)
t
- point to checkpublic boolean contains(org.epics.util.time.TimeInterval i)
i
- interval to checkpublic boolean intersects(org.epics.util.time.TimeInterval i)
i
- interval to checkpublic void addToSelf(org.epics.util.time.TimeInterval 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 instancepublic static IntervalsList add(IntervalsList list, org.epics.util.time.TimeInterval i)
list
- intervals listi
- intervalpublic void subtractFromSelf(org.epics.util.time.TimeInterval 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 removepublic static IntervalsList subtract(IntervalsList list, org.epics.util.time.TimeInterval i)
list
- intervals listi
- interval to removepublic void intersectSelf(org.epics.util.time.TimeInterval i)
i
- intervalpublic static IntervalsList intersection(IntervalsList list, org.epics.util.time.TimeInterval i)
list
- intervals listi
- intervalpublic 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 instancepublic static IntervalsList add(IntervalsList list1, IntervalsList list2)
list1
- first intervals listlist2
- second intervals listpublic void subtractFromSelf(IntervalsList list)
list
- intervals list to removepublic static IntervalsList subtract(IntervalsList list1, IntervalsList list2)
list1
- intervals listlist2
- intervals list to removepublic void intersectSelf(IntervalsList list)
list
- list to intersect with the instancepublic static IntervalsList intersection(IntervalsList list1, IntervalsList list2)
list1
- first intervals listlist2
- second intervals listCopyright © 2010–2015. All rights reserved.