Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntervalIntersectionIterator Constructor #54

Closed
CiaranOMara opened this issue May 2, 2020 · 1 comment · Fixed by #58
Closed

IntervalIntersectionIterator Constructor #54

CiaranOMara opened this issue May 2, 2020 · 1 comment · Fixed by #58

Comments

@CiaranOMara
Copy link
Member

The IntervalIntersectionIterator constructor starting at line 1348 doesn't look correct.

mutable struct IntervalIntersectionIterator{F, K, V, B}
filter::F
intersection::Intersection{K, V, B}
t::IntervalBTree{K, V, B}
query::AbstractInterval{K}
function IntervalIntersectionIterator{F,K,V,B}(filter, intersection, t, query) where {F,K,V,B}
return new{F,K,V,B}(filter, intersection, t, query)
end
function IntervalIntersectionIterator{F,K,V,B}() where {F,K,V,B}
return new{F,K,V,B}(Intersection{F, K, V, B}())
end
end

It supplies too many parameters to Intersection.

mutable struct Intersection{K, V, B}
index::Int
node::LeafNode{K, V, B}
Intersection{K,V,B}(index, node) where {K,V,B} = new{K,V,B}(index, node)
Intersection{K,V,B}() where {K,V,B} = new{K,V,B}(0)
end

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant