3 template <
typename Self,
typename TLinksOptions>
5 :
public Platform::Collections::Methods::Trees::SizeBalancedTreeMethods<Self,
6 typename TLinksOptions::LinkAddressType>
10 using LinkType =
typename LinksOptionsType::LinkType;
12 static constexpr LinksConstants<LinkAddressType>
Constants = LinksOptionsType::Constants;
15 using methods = Platform::Collections::Methods::Trees::SizeBalancedTreeMethods<Self, LinkAddressType>;
42 return LinkType{linkIndex, link.Source, link.Target};
50 return this->object().FirstIsToTheLeftOfSecond(firstLink.Source, firstLink.Target, secondLink.Source,
59 return this->object().FirstIsToTheRightOfSecond(firstLink.Source, firstLink.Target, secondLink.Source,
65 auto root = this->object().GetTreeRoot();
66 if (index >= this->
object().GetSize(root))
72 auto left = GetLeftOrDefault(root);
73 auto leftSize = GetSizeOrZero(left);
79 if (index == leftSize)
83 root = GetRightOrDefault(root);
84 index = index - (leftSize + 1);
92 auto root = this->object().GetTreeRoot();
96 auto rootSource = rootLink.Source;
97 auto rootTarget = rootLink.Target;
100 root = this->GetLeftOrDefault(root);
104 root = this->GetRightOrDefault(root);
117 auto root = this->object().GetTreeRoot();
118 auto total = this->object().GetSize(root);
119 auto totalRightIgnore = 0;
122 auto base = this->object().GetBasePartValue(root);
123 if (base <= linkAddress)
125 root = this->GetRightOrDefault(root);
129 totalRightIgnore = totalRightIgnore + (this->GetRightSize(root) + 1);
130 root = this->GetLeftOrDefault(root);
133 root = this->object().GetTreeRoot();
134 auto totalLeftIgnore = 0;
137 auto base = this->object().GetBasePartValue(root);
138 if (base >= linkAddress)
140 root = this->GetLeftOrDefault(root);
144 totalLeftIgnore = totalLeftIgnore + (this->GetLeftSize(root) + 1);
145 root = this->GetRightOrDefault(root);
148 return total - totalRightIgnore - totalLeftIgnore;
154 return this->EachUsageCore(base, this->
object().GetTreeRoot(), handler);
161 if (linkAddress == 0)
165 auto linkBasePart = this->object().GetBasePartValue(linkAddress);
167 if (linkBasePart > (base))
169 if ((this->EachUsageCore(base, this->GetLeftOrDefault(linkAddress), handler) == $break))
174 else if (linkBasePart < base)
176 if ((this->EachUsageCore(base, this->GetRightOrDefault(linkAddress), handler) == $break))
184 if (handler(link) == ($break))
188 if ((this->EachUsageCore(base, this->GetLeftOrDefault(linkAddress), handler) == $break))
192 if ((this->EachUsageCore(base, this->GetRightOrDefault(linkAddress), handler) == $break))