4 template <
typename Self,
typename TLinksOptions>
6 :
public Platform::Collections::Methods::Trees::RecursionlessSizeBalancedTreeMethods<
7 Self, typename TLinksOptions::LinkAddressType>
11 using LinkType =
typename LinksOptionsType::LinkType;
13 static constexpr LinksConstants<LinkAddressType>
Constants = LinksOptionsType::Constants;
17 Platform::Collections::Methods::Trees::RecursionlessSizeBalancedTreeMethods<Self, LinkAddressType>;
34 return this->object().GetTreeRoot();
40 return this->object().GetBasePartValue(linkAddress);
47 return this->object().FirstIsToTheRightOfSecond(source, target, rootSource, rootTarget);
54 return this->object().FirstIsToTheLeftOfSecond(source, target, rootSource, rootTarget);
73 return LinkType{linkIndex, link.Source, link.Target};
97 if (index >= this->
object.GetSize(root))
103 auto left = GetLeftOrDefault(root);
104 auto leftSize = GetSizeOrZero(left);
105 if (index < leftSize)
110 if (index == leftSize)
114 root = GetRightOrDefault(root);
115 index = index - (leftSize + 1);
127 auto rootSource = rootLink.Source;
128 auto rootTarget = rootLink.Target;
131 root = this->GetLeftOrDefault(root);
135 root = this->GetRightOrDefault(root);
149 auto total = this->object().GetSize(root);
150 auto totalRightIgnore = 0;
154 if (base <= linkAddress)
156 root = this->GetRightOrDefault(root);
160 totalRightIgnore = totalRightIgnore + (this->GetRightSize(root) + 1);
161 root = this->GetLeftOrDefault(root);
165 auto totalLeftIgnore = 0;
169 if (base >= linkAddress)
171 root = this->GetLeftOrDefault(root);
175 totalLeftIgnore = totalLeftIgnore + (this->GetLeftSize(root) + 1);
176 root = this->GetRightOrDefault(root);
179 return total - totalRightIgnore - totalLeftIgnore;
185 return this->EachUsageCore(base, this->
GetTreeRoot(), handler);
194 if (linkAddress == 0)
199 if (linkBasePart > (base))
201 if ((this->EachUsageCore(base, this->GetLeftOrDefault(linkAddress), handler) == $break))
206 else if (linkBasePart < base)
208 if ((this->EachUsageCore(base, this->GetRightOrDefault(linkAddress), handler) == $break))
216 if (handler(link) == ($break))
220 if ((this->EachUsageCore(base, this->GetLeftOrDefault(linkAddress), handler) == $break))
224 if ((this->EachUsageCore(base, this->GetRightOrDefault(linkAddress), handler) == $break))