|
Gephi Toolkit Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gephi.data.attributes.type.IntervalTree<T>
T
- type of datapublic final class IntervalTree<T>
It is essentially a map from intervals to object which can be queried for
Interval
instances associated with a particular interval of time.
Insertion can be performed in O(lg n) time, where n is the number of nodes. All intervals in a tree that overlap some interval i can be listed in O(min(n, k lg n) time, where k is the number of intervals in the output list. Thus search and deletion can be performed in this time.
The space consumption is O(n).
Note that this implementation doesn't allow intervals to be duplicated.
References:
Constructor Summary | |
---|---|
IntervalTree()
Constructs an empty IntervalTree . |
|
IntervalTree(IntervalTree intervalTree)
Constructs a copy of the given IntervalTree . |
Method Summary | |
---|---|
void |
delete(Interval interval)
Removes all intervals from this IntervalTree that overlap with
the given interval . |
boolean |
equals(java.lang.Object obj)
Compares this interval tree with the specified object for equality. |
double |
getHigh()
Returns the rightmost point or Double.POSITIVE_INFINITY in case
of no intervals. |
double |
getLow()
Returns the leftmost point or Double.NEGATIVE_INFINITY in case
of no intervals. |
int |
hashCode()
Returns a hashcode of this interval tree. |
void |
insert(Interval<T> interval)
Inserts the interval into this IntervalTree . |
boolean |
isEmpty()
Indicates if this IntervalTree contains 0 intervals. |
boolean |
isHighExcluded()
Indicates if the rightmost point is excluded. |
boolean |
isLowExcluded()
Indicates if the leftmost point is excluded. |
Interval<T> |
maximum()
Returns the interval with the highest left endpoint. |
Interval<T> |
minimum()
Returns the interval with the lowest left endpoint. |
boolean |
overlapsWith(Interval interval)
Indicates if this IntervalTree overlaps with the given time interval. |
java.util.List<Interval<T>> |
search(double low,
double high)
Returns all intervals overlapping with an interval given by low
and high . |
java.util.List<Interval<T>> |
search(Interval interval)
Returns all intervals overlapping with a given Interval . |
java.lang.String |
toString()
Returns a string representation of this interval tree in a format <[low, high, value], ..., [low, high, value]> . |
java.lang.String |
toString(boolean timesAsDoubles)
Creates a string representation of all the intervals with their values. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IntervalTree()
IntervalTree
.
public IntervalTree(IntervalTree intervalTree)
IntervalTree
.
intervalTree
- a copied IntervalTree
Method Detail |
---|
public void insert(Interval<T> interval)
interval
into this IntervalTree
.
interval
- an interval to be inserted
java.lang.NullPointerException
- if interval
is null.public void delete(Interval interval)
IntervalTree
that overlap with
the given interval
.
interval
- determines which intervals should be removed
java.lang.NullPointerException
- if interval
is null.public Interval<T> minimum()
public Interval<T> maximum()
public double getLow()
Double.NEGATIVE_INFINITY
in case
of no intervals.
public double getHigh()
Double.POSITIVE_INFINITY
in case
of no intervals.
public boolean isLowExcluded()
true
if the leftmost point is excluded,
false
otherwise.public boolean isHighExcluded()
true
if the rightmost point is excluded,
false
otherwise.public boolean isEmpty()
IntervalTree
contains 0 intervals.
true
if this IntervalTree
is empty,
false
otherwise.public java.util.List<Interval<T>> search(Interval interval)
Interval
.
interval
- an {#code Interval} to be searched for overlaps
Interval
.
java.lang.NullPointerException
- if interval
is null.public java.util.List<Interval<T>> search(double low, double high)
low
and high
. They are considered as included by default.
low
- the left endpoint of an interval to be searched for overlapshigh
- the right endpoint an interval to be searched for overlaps
low
and high
.
java.lang.IllegalArgumentException
- if low
> high
.public boolean overlapsWith(Interval interval)
IntervalTree
overlaps with the given time interval.
interval
- a given time interval
true
if this IntervalTree
overlaps with interval
,
false
otherwise.public boolean equals(java.lang.Object obj)
Note that two interval trees are equal if they contain the same intervals.
equals
in class java.lang.Object
obj
- object to which this interval tree is to be compared
true
if and only if the specified Object
is a
IntervalTree
which contain the same intervals as this
IntervalTree's
.hashCode()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString(boolean timesAsDoubles)
timesAsDoubles
- indicates if times should be shown as doubles or dates
public java.lang.String toString()
<[low, high, value], ..., [low, high, value]>
. Nodes are visited
in inorder
.
Times are always shown as doubles.
toString
in class java.lang.Object
|
Gephi Toolkit Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |