BioJulia / IntervalTrees.jl

A data structure for efficient manipulation of sets of intervals
MIT License
44 stars 17 forks source link

IntervalIntersectionIterator Constructor #54

Closed CiaranOMara closed 1 year ago

CiaranOMara commented 4 years ago

The IntervalIntersectionIterator constructor starting at line 1348 doesn't look correct. https://github.com/BioJulia/IntervalTrees.jl/blob/2f63a6c73b1bf872ab7bccd859e581f548eba2d2/src/IntervalTrees.jl#L1338-L1351

It supplies too many parameters to Intersection. https://github.com/BioJulia/IntervalTrees.jl/blob/2f63a6c73b1bf872ab7bccd859e581f548eba2d2/src/IntervalTrees.jl#L1129-L1135

The following is may be the intended constructor for IntervalIntersectionIterator.

    function IntervalIntersectionIterator{F,K,V,B}() where {F,K,V,B}
         iter = new{F,K,V,B}()
         iter.intersection = Intersection{K,V,B}()
         return iter
    end
CiaranOMara commented 4 years ago

Inspecting the downstream use of IntervalIntersectionIterator, it requires populated fields to supply arguments to firstintersection!. I don't think this package needs to cover the case of iterating over an empty tree that is not supplied. I think the faulty constructor can be removed.