|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdata.IntervalList
public class IntervalList
IntervalList
This class represents a list of intervals, i.e. a subset of the real numbers. An empty list is represented by an IntervalList of zero length (getLength() returns zero).Copyright(c) 2005 Université Laval, LSFM research group.
Interval
,
Serialized FormConstructor Summary | |
---|---|
IntervalList()
Constructor with no parameter... creates an empty list. |
|
IntervalList(Interval i)
Constructor with one interval as parameter... |
|
IntervalList(IntervalList l)
Copy constructor ... |
|
IntervalList(java.lang.String s)
Construct a list of interval from a string. |
Method Summary | |
---|---|
void |
add(Interval i)
Add the interval i to the current list, unifying if necessary. |
void |
add(java.lang.String interval)
Add an interval in the form of a string. |
IntervalList |
copy()
Returns a copy of the current list. |
boolean |
equals(java.lang.Object o)
Returns true if the object is semantically equivalent to the current list. |
Interval |
getIntervalAt(int index)
Returns the interval at the specified index. |
int |
getSize()
Returns the number of intervals in the list. |
int |
indexOf(double v)
This methods find the value v in the interval list and returns the index of the interval which contains the v value. |
static IntervalList |
intersectionOf(IntervalList list1,
IntervalList list2)
Returns the intersection of two lists. |
boolean |
isEmpty()
Returns 'True' if the list is empty. |
boolean |
isIn(double v)
Returns 'True' should the value be part of an interval of the list |
boolean |
isIncluded(Interval smaller)
Returns true if the interval is included or equal to the current list. |
boolean |
isIncluded(IntervalList smaller)
Returns true if the smaller interval is included into the list or is equal |
static IntervalList |
substract(IntervalList s,
IntervalList l)
This methods compute the negation of the division of the two sets |
java.lang.String |
toString()
Convert the current list a string. |
static IntervalList |
union(IntervalList list,
Interval i)
Compute the unification of an interval with a list. |
static IntervalList |
union(IntervalList list1,
IntervalList list2)
Unify two list of intervals. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IntervalList()
public IntervalList(Interval i)
i
- the interval to include in the listpublic IntervalList(java.lang.String s) throws DataParserException
For example : [0,5] U {6} U (-10,-3]
The intervals do not need to be sorted.
s
- a valid chain representing an interval list
DataParserException
- should the string not respect the IntervalList formatpublic IntervalList(IntervalList l)
l
- the IntervalList to copy.Method Detail |
---|
public Interval getIntervalAt(int index)
index
- the index of the interval to return
java.lang.IndexOutOfBoundsException
- if the index is out of bound (index < 0 || index >= size()).public int getSize()
public static IntervalList union(IntervalList list1, IntervalList list2)
list1
- the first listlist2
- the second list
IntervalList.copy()
public static IntervalList union(IntervalList list, Interval i)
i
- the interval to unify with the listlist
- the list to be unified
(IntervalList, IntervalList)
public void add(Interval i)
i
- the interval to addpublic void add(java.lang.String interval) throws DataParserException
interval
- a string representing the interval
DataParserException
- should the string be malformedInterval.Interval(String)
,
add(Interval)
public static IntervalList intersectionOf(IntervalList list1, IntervalList list2)
list1
- the first interval listlist2
- the second interval list
public static IntervalList substract(IntervalList s, IntervalList l)
s
- the first setl
- the second set
public int indexOf(double v)
v
- the value to seek
public boolean isIn(double v)
v
- a real number to seek
indexOf(double)
public boolean isIncluded(IntervalList smaller)
true
if the smaller interval is included into the list or is equal
smaller
- the smaller interval to seek
public boolean isIncluded(Interval smaller)
smaller
- the interval to check
isIncluded(IntervalList)
public boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
IntervalList(String)
public IntervalList copy()
IntervalList(IntervalList)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |