Skip to content

Commit

Permalink
temp fix for Irregular Interval between methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Apr 10, 2020
1 parent 140095a commit 54ad272
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/selector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,33 @@ between(indexord::Reverse, ::Points, dim::Dimension, sel) = begin
relate(dim, a:b)
end
between(indexord, s::Intervals, dim::Dimension, sel) =
between(span(mode(dim)), indexord, s, dim, sel)
between(span::Regular, indexord::Forward, ::Intervals, dim::Dimension, sel) = begin
between(span(mode(dim)), indexord, dim, sel)
between(span::Regular, indexord::Forward, dim::Dimension, sel) = begin
low, high = _sorttuple(sel) .+ _locus_adjustment(mode(dim), span)
a = _inbounds(_searchfirst(dim, low), dim)
b = _inbounds(_searchlast(dim, high), dim)
relate(dim, a:b)
end
between(span::Regular, indexord::Reverse, ::Intervals, dim::Dimension, sel) = begin
between(span::Regular, indexord::Reverse, dim::Dimension, sel) = begin
low, high = _sorttuple(sel) .+ _locus_adjustment(mode(dim), span)
a = _inbounds(_searchfirst(dim, high), dim)
b = _inbounds(_searchlast(dim, low), dim)
relate(dim, a:b)
end
# TODO do this properly.
# The intervals need to be between the selection, not the points.
between(span::Irregular, indexord::Forward, dim::Dimension, sel) = begin
low, high = _sorttuple(sel)
a = _inbounds(_searchfirst(dim, low), dim)
b = _inbounds(_searchlast(dim, high), dim)
relate(dim, a:b)
end
between(span::Irregular, indexord::Reverse, dim::Dimension, sel) = begin
low, high = _sorttuple(sel)
a = _inbounds(_searchlast(dim, high), dim)
b = _inbounds(_searchfirst(dim, low), dim)
relate(dim, a:b)
end

# Reverse index needs to use rev=true and lt=<= for searchsorted
# so that it is exactly the revsese of a forward index
Expand Down

0 comments on commit 54ad272

Please sign in to comment.