|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.viper.util.Range
This class represents a set of Intervals. Note that all indexes must all be Comparable.
Nested Class Summary |
Nested classes inherited from class edu.umd.cfar.lamp.viper.util.IntervalIndexList |
IntervalIndexList.Change |
Constructor Summary | |
Range()
Creates a new, empty Range. |
|
Range(java.util.Collection c)
Creates a new Range from a Collection of Span objects. |
|
Range(java.util.Comparator c)
Creates a new, empty Range. |
Method Summary | |
boolean |
add(java.lang.Comparable start,
java.lang.Comparable stop)
Subsumes the Instants in the Span into this Range. |
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(IntervalIndexList l)
Adds all the elements from the given list at their specified locations |
boolean |
addAll(java.util.Iterator iter)
Adds all the elements described by the iterator. |
void |
clear()
Removes all elements from the list. |
java.lang.Object |
clone()
|
protected void |
cloneInto(Range r)
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
Interval |
createInterval(java.lang.Comparable s,
java.lang.Comparable e)
Creates a new interval. |
java.lang.Comparable |
endOf(java.lang.Comparable c)
Gets the end of the element in which c is contained. |
boolean |
equals(java.lang.Object o)
|
java.lang.Comparable |
firstAfter(java.lang.Comparable oldStart)
Gets the start of the first element that begins strictly after c. |
java.lang.Comparable |
firstAfterOrAt(java.lang.Comparable oldStart)
Gets the start of the first element that begins at c or after it. |
java.lang.Comparable |
firstBefore(java.lang.Comparable oldStart)
Gets the start of the first element before c, exclusive. |
java.lang.Object |
get(java.lang.Comparable index)
Returns null if the moment is in the span, otherwise returns Boolean.TRUE. |
int |
getContiguousIntervalCount()
Gets a count of the contiguous (and homogenous, for those sort of things) intervals in the list. |
Interval |
getExtrema()
Gets the Span that starts at the beginning of the first Span and ends at the end of the last Span. |
int |
hashCode()
|
Range |
intersect(IntervalIndexList list)
Gets the range shared by this and the specified range. |
Range |
intersectComplement(Range o)
Gets all elements from this that are not elements of the specified range. |
boolean |
intersects(Interval s)
Checks to see if some interval of this intersects the specified interval. |
boolean |
intersects(Range r)
Tests to see if the this intersects the other range. |
boolean |
intersects(java.util.Set s)
Tests to see if this range contains any element or intersects any element of the specified set. |
boolean |
isEmpty()
True if no elements are described in the list. |
java.util.Iterator |
iterator()
Gets an iterator over all the Interval objects here. |
java.util.Iterator |
iterator(Interval i)
Gets an iterator over all the Interval objects that intersect the given Interval. |
void |
map(IntervalIndexList.Change c)
Changes all the values of the elements by the given change function object. |
boolean |
remove(java.lang.Comparable start,
java.lang.Comparable end)
Removes all values at the given range. |
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
retainAll(java.util.Collection c)
TODO: currently unsupported |
void |
set(java.lang.Comparable start,
java.lang.Comparable stop,
java.lang.Object value)
Since this is just a range, this ignores the value object except to check if it is "null". |
boolean |
setSpans(java.util.Collection s)
Adds all of the Span objects in the Collection s to this one. |
int |
size()
Gets the number of disconnected ranges of Instants this Range contains. |
IntervalIndexList |
subList(java.lang.Comparable start,
java.lang.Comparable stop)
Gets the sublist in the given interval |
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] A)
|
java.lang.String |
toString()
Returns the list as a space delimited of "s:e" pairs. |
Range |
union(Range o)
Gets the union of this and the specified range. |
boolean |
withinRange(java.lang.Comparable s,
java.lang.Comparable e)
Checks to see if the interval defined as [s,e) is entirely contained within this Range object. |
boolean |
withinRange(Interval s)
Checks that this is |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Range()
public Range(java.util.Comparator c)
c
- The comparison to use while adding items to the range.public Range(java.util.Collection c)
c
- the intervals to addMethod Detail |
public int size()
size
in interface java.util.Set
public boolean withinRange(Interval s)
s
-
public boolean withinRange(java.lang.Comparable s, java.lang.Comparable e)
s
- e
-
public java.lang.Object get(java.lang.Comparable index)
get
in interface IntervalIndexList
index
- the index to see if is in range
null
or Boolean.TRUE
public void set(java.lang.Comparable start, java.lang.Comparable stop, java.lang.Object value)
set
in interface IntervalIndexList
start
- the start point, inclusivestop
- the end point, exclusivevalue
- the value to set over the given rangepublic boolean add(java.lang.Comparable start, java.lang.Comparable stop)
start
- the first instant to addstop
- the stop instant, exclusive
true
iff the operation modified this Rangepublic Interval getExtrema()
public boolean remove(java.lang.Comparable start, java.lang.Comparable end)
IntervalIndexList
SortedMap
, this means that value is set in the
range from start, inclusive, to stop, exclusive.
remove
in interface IntervalIndexList
start
- the first index to removeend
- the first index that is not removed
true
if any elements were removedIntervalIndexList.remove(java.lang.Comparable, java.lang.Comparable)
public boolean setSpans(java.util.Collection s)
s
- a set of homogenous type Span objects
true
if any new Instants are now
part of this set.protected void cloneInto(Range r)
public java.lang.Object clone()
Object.clone()
public boolean add(java.lang.Object o)
add
in interface java.util.Set
Set.add(java.lang.Object)
public boolean addAll(java.util.Iterator iter)
iter
- the elements to add
this
changedpublic boolean addAll(java.util.Collection c)
addAll
in interface java.util.Set
Set.addAll(java.util.Collection)
public void clear()
IntervalIndexList
clear
in interface java.util.Set
Set.clear()
public boolean contains(java.lang.Object o)
contains
in interface java.util.Set
Set.contains(java.lang.Object)
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Set
Set.containsAll(java.util.Collection)
public boolean isEmpty()
IntervalIndexList
isEmpty
in interface java.util.Set
Set.isEmpty()
public java.util.Iterator iterator()
IntervalIndexList
iterator
in interface java.util.Set
public java.util.Iterator iterator(Interval i)
IntervalIndexList
iterator
in interface IntervalIndexList
public boolean remove(java.lang.Object o)
remove
in interface java.util.Set
Set.remove(java.lang.Object)
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Set
Set.removeAll(java.util.Collection)
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Set
Set.retainAll(java.util.Collection)
public java.lang.Object[] toArray()
toArray
in interface java.util.Set
Set.toArray()
public java.lang.Object[] toArray(java.lang.Object[] A)
toArray
in interface java.util.Set
Set.toArray(java.lang.Object[])
public java.lang.String toString()
Object.toString()
public boolean equals(java.lang.Object o)
equals
in interface java.util.Set
Set.equals(java.lang.Object)
public int hashCode()
hashCode
in interface java.util.Set
Set.hashCode()
public boolean intersects(java.util.Set s)
s
- the set to test against
public boolean intersects(Range r)
r
- the range to test against
true
if there is some shared intervalpublic boolean intersects(Interval s)
s
- the interval to test against
true
if there is some overlappublic Range intersect(IntervalIndexList list)
list
- the list to intersect with
public java.lang.Comparable firstBefore(java.lang.Comparable oldStart)
IntervalIndexList
firstBefore
in interface IntervalIndexList
oldStart
- Where to start looking backwards from
null
if none foundIntervalIndexList.firstBefore(java.lang.Comparable)
public java.lang.Comparable firstAfter(java.lang.Comparable oldStart)
IntervalIndexList
firstAfter
in interface IntervalIndexList
oldStart
- the place to start looking
null
if none foundIntervalIndexList.firstAfter(java.lang.Comparable)
public java.lang.Comparable firstAfterOrAt(java.lang.Comparable oldStart)
IntervalIndexList
firstAfterOrAt
in interface IntervalIndexList
oldStart
- the place to start looking
null
if none foundIntervalIndexList.firstAfterOrAt(java.lang.Comparable)
public java.lang.Comparable endOf(java.lang.Comparable c)
IntervalIndexList
endOf
in interface IntervalIndexList
c
- the element to check
null
if c isn't within an interval
described by this listIntervalIndexList.endOf(java.lang.Comparable)
public Range union(Range o)
o
- the range to union with
public Range intersectComplement(Range o)
o
- the range to complement
public boolean addAll(IntervalIndexList l)
IntervalIndexList
addAll
in interface IntervalIndexList
l
- the list to add
IntervalIndexList.addAll(edu.umd.cfar.lamp.viper.util.IntervalIndexList)
public IntervalIndexList subList(java.lang.Comparable start, java.lang.Comparable stop)
IntervalIndexList
subList
in interface IntervalIndexList
start
- the start of the chop, inclusivestop
- the end of the chop, exclusive
IntervalIndexList.subList(java.lang.Comparable, java.lang.Comparable)
public void map(IntervalIndexList.Change c)
IntervalIndexList
map
in interface IntervalIndexList
c
- the method to apply to all elementsIntervalIndexList.map(edu.umd.cfar.lamp.viper.util.IntervalIndexList.Change)
public Interval createInterval(java.lang.Comparable s, java.lang.Comparable e)
s
- e
-
public int getContiguousIntervalCount()
IntervalIndexList
getContiguousIntervalCount
in interface IntervalIndexList
IntervalIndexList.getContiguousIntervalCount()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |