@@ -1773,20 +1773,12 @@ namespace lib_interval_tree
1773
1773
}
1774
1774
if (ptr->left_ && ival.high () <= ptr->left_ ->max ())
1775
1775
{
1776
- // no right? can only continue left
1777
- if (!ptr->right_ || ival.low () > ptr->right_ ->max ())
1778
- return find_all_i<ThisType, IteratorT>(self, ptr->left_ , ival, on_find, compare);
1779
-
1780
1776
if (!find_all_i<ThisType, IteratorT>(self, ptr->left_ , ival, on_find, compare))
1781
1777
return false ;
1782
1778
}
1783
1779
if (ptr->right_ && ival.high () <= ptr->right_ ->max ())
1784
1780
{
1785
- if (!ptr->left_ || ival.low () > ptr->left_ ->max ())
1786
- return find_all_i<ThisType, IteratorT>(self, ptr->right_ , ival, on_find, compare);
1787
-
1788
- if (!find_all_i<ThisType, IteratorT>(self, ptr->right_ , ival, on_find, compare))
1789
- return false ;
1781
+ return find_all_i<ThisType, IteratorT>(self, ptr->right_ , ival, on_find, compare);
1790
1782
}
1791
1783
return true ;
1792
1784
}
@@ -1807,22 +1799,13 @@ namespace lib_interval_tree
1807
1799
{
1808
1800
if (ptr->left_ && ival.high () <= ptr->left_ ->max ())
1809
1801
{
1810
- // no right? can only continue left
1811
- if (!ptr->right_ || ival.low () > ptr->right_ ->max ())
1812
- return find_i (ptr->left_ , ival, compare);
1813
-
1814
1802
auto * res = find_i (ptr->left_ , ival, compare);
1815
1803
if (res != nullptr )
1816
1804
return res;
1817
1805
}
1818
1806
if (ptr->right_ && ival.high () <= ptr->right_ ->max ())
1819
1807
{
1820
- if (!ptr->left_ || ival.low () > ptr->left_ ->max ())
1821
- return find_i (ptr->right_ , ival, compare);
1822
-
1823
- auto * res = find_i (ptr->right_ , ival, compare);
1824
- if (res != nullptr )
1825
- return res;
1808
+ return find_i (ptr->right_ , ival, compare);
1826
1809
}
1827
1810
return nullptr ;
1828
1811
}
@@ -1884,21 +1867,12 @@ namespace lib_interval_tree
1884
1867
}
1885
1868
if (ptr->left_ && ptr->left_ ->max () >= ival.low ())
1886
1869
{
1887
- // no right? can only continue left
1888
- // or interval low is bigger than max of right branch.
1889
- if (!ptr->right_ || ival.low () > ptr->right_ ->max ())
1890
- return overlap_find_all_i<ThisType, Exclusive, IteratorT>(self, ptr->left_ , ival, on_find);
1891
-
1892
1870
if (!overlap_find_all_i<ThisType, Exclusive, IteratorT>(self, ptr->left_ , ival, on_find))
1893
1871
return false ;
1894
1872
}
1895
1873
if (ptr->right_ && ptr->right_ ->max () >= ival.low ())
1896
1874
{
1897
- if (!ptr->left_ || ival.low () > ptr->right_ ->max ())
1898
- return overlap_find_all_i<ThisType, Exclusive, IteratorT>(self, ptr->right_ , ival, on_find);
1899
-
1900
- if (!overlap_find_all_i<ThisType, Exclusive, IteratorT>(self, ptr->right_ , ival, on_find))
1901
- return false ;
1875
+ return overlap_find_all_i<ThisType, Exclusive, IteratorT>(self, ptr->right_ , ival, on_find);
1902
1876
}
1903
1877
return true ;
1904
1878
}
@@ -1909,23 +1883,13 @@ namespace lib_interval_tree
1909
1883
{
1910
1884
if (ptr->left_ && ptr->left_ ->max () >= ival.low ())
1911
1885
{
1912
- // no right? can only continue left
1913
- // or upper bounds higher than what is contained right? continue left.
1914
- if (!ptr->right_ || ival.low () > ptr->right_ ->max ())
1915
- return overlap_find_i<Exclusive>(ptr->left_ , ival);
1916
-
1917
1886
auto * res = overlap_find_i<Exclusive>(ptr->left_ , ival);
1918
1887
if (res != nullptr )
1919
1888
return res;
1920
1889
}
1921
1890
if (ptr->right_ && ptr->right_ ->max () >= ival.low ())
1922
1891
{
1923
- if (!ptr->left_ || ival.low () > ptr->left_ ->max ())
1924
- return overlap_find_i<Exclusive>(ptr->right_ , ival);
1925
-
1926
- auto * res = overlap_find_i<Exclusive>(ptr->right_ , ival);
1927
- if (res != nullptr )
1928
- return res;
1892
+ return overlap_find_i<Exclusive>(ptr->right_ , ival);
1929
1893
}
1930
1894
return nullptr ;
1931
1895
}
0 commit comments