aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/containers/disjoint_interval_tree
diff options
context:
space:
mode:
authoralexnick <alexnick@yandex-team.ru>2022-02-10 16:47:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:45 +0300
commitb609303efcd1218868ca0eca806ea3cea2e01a8b (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/containers/disjoint_interval_tree
parent80ba7327fdd90a6281bcec18f03e84ff856c3559 (diff)
downloadydb-b609303efcd1218868ca0eca806ea3cea2e01a8b.tar.gz
Restoring authorship annotation for <alexnick@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers/disjoint_interval_tree')
-rw-r--r--library/cpp/containers/disjoint_interval_tree/disjoint_interval_tree.h18
-rw-r--r--library/cpp/containers/disjoint_interval_tree/ut/disjoint_interval_tree_ut.cpp32
2 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/containers/disjoint_interval_tree/disjoint_interval_tree.h b/library/cpp/containers/disjoint_interval_tree/disjoint_interval_tree.h
index 53108ad90f..1f899c9991 100644
--- a/library/cpp/containers/disjoint_interval_tree/disjoint_interval_tree.h
+++ b/library/cpp/containers/disjoint_interval_tree/disjoint_interval_tree.h
@@ -222,15 +222,15 @@ private:
// try to extend interval
if (p != Tree.end() && p->second == begin) {
p->second = end;
- //Try to merge 2 intervals - p and next one if possible
- auto next = p;
- // Next is not Tree.end() here.
- ++next;
- if (next != Tree.end() && next->first == end) {
- p->second = next->second;
- Tree.erase(next);
- }
- // Maybe new interval extends right interval
+ //Try to merge 2 intervals - p and next one if possible
+ auto next = p;
+ // Next is not Tree.end() here.
+ ++next;
+ if (next != Tree.end() && next->first == end) {
+ p->second = next->second;
+ Tree.erase(next);
+ }
+ // Maybe new interval extends right interval
} else if (l != Tree.end() && end == l->first) {
T& leftBorder = const_cast<T&>(l->first);
// Optimization hack.
diff --git a/library/cpp/containers/disjoint_interval_tree/ut/disjoint_interval_tree_ut.cpp b/library/cpp/containers/disjoint_interval_tree/ut/disjoint_interval_tree_ut.cpp
index a9a9fd1a07..8474ae89b0 100644
--- a/library/cpp/containers/disjoint_interval_tree/ut/disjoint_interval_tree_ut.cpp
+++ b/library/cpp/containers/disjoint_interval_tree/ut/disjoint_interval_tree_ut.cpp
@@ -55,22 +55,22 @@ Y_UNIT_TEST_SUITE(DisjointIntervalTreeTest) {
UNIT_ASSERT_VALUES_EQUAL(begin->first, 2);
UNIT_ASSERT_VALUES_EQUAL(begin->second, 7);
}
-
- // Merge all intervals.
- {
- TDisjointIntervalTree<ui64> tree;
- tree.InsertInterval(0, 3);
- tree.InsertInterval(6, 10);
- tree.InsertInterval(3, 6);
-
- UNIT_ASSERT_VALUES_EQUAL(tree.GetNumIntervals(), 1);
- UNIT_ASSERT_VALUES_EQUAL(tree.GetNumElements(), 10);
-
- auto begin = tree.begin();
- UNIT_ASSERT_VALUES_EQUAL(begin->first, 0);
- UNIT_ASSERT_VALUES_EQUAL(begin->second, 10);
- }
-
+
+ // Merge all intervals.
+ {
+ TDisjointIntervalTree<ui64> tree;
+ tree.InsertInterval(0, 3);
+ tree.InsertInterval(6, 10);
+ tree.InsertInterval(3, 6);
+
+ UNIT_ASSERT_VALUES_EQUAL(tree.GetNumIntervals(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(tree.GetNumElements(), 10);
+
+ auto begin = tree.begin();
+ UNIT_ASSERT_VALUES_EQUAL(begin->first, 0);
+ UNIT_ASSERT_VALUES_EQUAL(begin->second, 10);
+ }
+
}
Y_UNIT_TEST(EraseIntervalTest) {