GithubHelp home page GithubHelp logo

jamarino / intervaltree Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 2.0 241 KB

A light-weight, performant interval tree in C#

License: MIT License

C# 100.00%
intervaltree memory-allocation performance

intervaltree's Issues

License not specified

Hey @jamarino, first, kudos for creating this library!

It seems that the project contains no license.
There is a MIT license link in the NuGet page that navigates to https://licenses.nuget.org/MIT, which is generic license text with placeholders.

AFAIK, no one can legally use your library until there is an explicit license that allows otherwise.
Could you please add a LICENSE file to the project?

Reverse interval not validated, then causes "Excessive recursion detected" exception

Hi @jamarino!
Thanks again for this library, so far it does exactly what I need.
There was a minor issue I came across.
I happened to incorrectly add a reversed interval to QuickIntervalTree (from greater than to).
No validation errors occurred.
However, when attempted to run Query, I got a System.Exception saying "Excessive recursion detected".
If reverse intervals cause such behavior, wouldn't it be better to validate from and to in the Add method?
Could save the users some time looking for their bugs.

Here is the reproduction:

var tree = new QuickIntervalTree<int, string>();

tree.Add(100, 200, "abc");
tree.Add(10, 20, "def");
tree.Add(-100, -200, "uvw"); // incorrect; should be (-200, -100)
tree.Add(50, 150, "xyz");

tree.Query(-150, 150).ToArray(); // System.Exception here
System.Exception : Excessive recursion detected, aborting to prevent stack overflow. Please check thread safety.
   at Jamarino.IntervalTree.QuickIntervalTree`2.<Build>g__BuildRec|18_0(Int32 min, Int32 max, Int32 nodeIndex, Int32 recursionLevel)
   at Jamarino.IntervalTree.QuickIntervalTree`2.<Build>g__BuildRec|18_0(Int32 min, Int32 max, Int32 nodeIndex, Int32 recursionLevel)
   at Jamarino.IntervalTree.QuickIntervalTree`2.<Build>g__BuildRec|18_0(Int32 min, Int32 max, Int32 nodeIndex, Int32 recursionLevel)
.......

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.