in src/lib/intervalTree.js [39:62]
function IntervalTree(center, options) {
options || (options = {});
this.startKey = options.startKey || 0; // start key
this.endKey = options.endKey || 1; // end key
this.intervalHash = {}; // id => interval object
this.pointTree = new SortedList({ // b-tree of start, end points
compare: function(a, b) {
if (a == null) return -1;
if (b == null) return 1;
var c = a[0]- b[0];
return (c > 0) ? 1 : (c == 0) ? 0 : -1;
}
});
this._autoIncrement = 0;
// index of the root node
if (!center || typeof center != 'number') {
throw new Error('you must specify center index as the 2nd argument.');
}
this.root = new Node(center, this);
}