import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
/**
*/
private List<NCNode<T>> subranges;
- /*
- * a comparator to sort intervals by start position ascending, with
- * longer (enclosing) intervals preceding those they enclose
- */
- Comparator<ContiguousI> intervalSorter = new RangeComparator(true);
-
/**
* Constructor given a list of things that are each located on a contiguous
* interval. Note that the constructor may reorder the list.
* sort by start ascending so that contained intervals
* follow their containing interval
*/
- Collections.sort(ranges, intervalSorter);
+ Collections.sort(ranges, RangeComparator.BY_START_POSITION);
List<Range> sublists = buildSubranges(ranges);
*/
protected int findFirstOverlap(long from)
{
- // TODO binary search
- // for now quick cheat linear search
+ /*
+ * The NCList paper describes binary search for this step,
+ * but this not implemented here as (a) I haven't understood it yet
+ * and (b) it seems to imply complications for adding to an NCList
+ */
+
int i = 0;
if (subranges != null)
{
if (subRegions != null)
{
subranges.addAll(subRegions.subranges);
- Collections.sort(subranges, intervalSorter);
+ Collections.sort(subranges, RangeComparator.BY_START_POSITION);
}
size--;
return true;