You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I monkey patched the lib to allow an optional 4th param to be set on the intervals. This helps in my case because I'm interested in the objects that "own" the intervals and think it would be useful to be able to directly access them after a query.
It seems to work fine, but I'm wondering if there is any performance hit from doing this.
Here's the changed code (in js):
IntervalTree.prototype.add=function(start,end,id,object){varinterval;if(this.intervalsById[id]!=null){thrownewError('id '+id+' is already registered.');}if(id==null){while(this.intervalsById[this.idCandidate]!=null){this.idCandidate++;}id=this.idCandidate;}Util.assertNumber(start,'1st argument of IntervalTree#add()');Util.assertNumber(end,'2nd argument of IntervalTree#add()');if(start>=end){Util.assertOrder(start,end,'start','end');}interval=newInterval(start,end,id,object);this.pointTree.insert(newPoint(interval.start,id));this.pointTree.insert(newPoint(interval.end,id));this.intervalsById[id]=interval;returnthis.insert(interval,this.root);};
I monkey patched the lib to allow an optional 4th param to be set on the intervals. This helps in my case because I'm interested in the objects that "own" the intervals and think it would be useful to be able to directly access them after a query.
It seems to work fine, but I'm wondering if there is any performance hit from doing this.
Here's the changed code (in js):
and
Thanks for your input and the excellent library @shinout
The text was updated successfully, but these errors were encountered: