com.limegroup.gnutella.util
Class IntervalSet
java.lang.Object
com.limegroup.gnutella.util.IntervalSet
- public class IntervalSet
- extends java.lang.Object
A "range" version of IntSet. This is a first cut of the class and does
not support all the operations IntSet does, just the ones we need for now.
Important Note: This class uses Interval from the download package. Ideally,
classes in the util package should be stand alone, but we need to have
Interval stay in downloads for reasons of backward compatibility.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IntervalSet
public IntervalSet()
add
public void add(Interval addInterval)
removeFirst
public Interval removeFirst()
getOverlapIntervals
public java.util.List getOverlapIntervals(Interval checkInterval)
- Returns:
- a List of intervals that overlap checkInterval. For example
if Intervals contains{[1-4],[6-10]} and checkInterval is [3-8],
this method should return a list of 2 intervals {[3-4],[6-8]}
If there are no overlaps, this method returns an empty List.
getAllIntervals
public java.util.Iterator getAllIntervals()
getAllIntervalsAsList
public java.util.List getAllIntervalsAsList()
getSize
public int getSize()
isEmpty
public boolean isEmpty()
clear
public void clear()
getNeededIntervals
public java.util.Iterator getNeededIntervals(int maxSize)
- Returns:
- an iterator or intervals needed to fill in the holes in this
IntervalSet. Note that the IntervalSet does not know the maximum value of
all the intervals.
toString
public java.lang.String toString()