3 template <
typename Self,
typename TLinksOptions>
5 :
public Platform::Collections::Methods::Trees::SizedAndThreadedAVLBalancedTreeMethods<
6 Self, typename TLinksOptions::LinkAddressType>
10 using LinkType =
typename LinksOptionsType::LinkType;
12 static constexpr LinksConstants<LinkAddressType>
Constants = LinksOptionsType::Constants;
22 Platform::Collections::Methods::Trees::SizedAndThreadedAVLBalancedTreeMethods<Self, LinkAddressType>;
36 auto root = this->object().GetTreeRoot();
37 if (index >= GetSize(root))
41 while (!EqualToZero(root))
43 auto left = GetLeftOrDefault(root);
44 auto leftSize = GetSizeOrZero(left);
50 if (AreEqual(index, leftSize))
54 root = GetRightOrDefault(root);
55 index = index - (leftSize + 1);
63 auto root = this->object().GetTreeRoot();
67 auto rootSource = rootLink.Source;
68 auto rootTarget = rootLink.Target;
71 root = this->GetLeftOrDefault(root);
75 root = this->GetRightOrDefault(root);
88 auto root = this->object().GetTreeRoot();
89 auto total = this->object().GetSize(root);
90 auto totalRightIgnore = 0;
93 auto base = this->object().GetBasePartValue(root);
96 root = this->GetRightOrDefault(root);
100 totalRightIgnore = totalRightIgnore + (this->GetRightSize(root) + 1);
101 root = this->GetLeftOrDefault(root);
104 root = this->object().GetTreeRoot();
105 auto totalLeftIgnore = 0;
108 auto base = this->object().GetBasePartValue(root);
111 root = this->GetLeftOrDefault(root);
115 totalLeftIgnore = totalLeftIgnore + (this->GetLeftSize(root) + 1);
117 root = this->GetRightOrDefault(root);
120 return (total - totalRightIgnore) - totalLeftIgnore;
126 auto root = this->object().GetTreeRoot();
134 auto base = this->object().GetBasePartValue(current);
141 current = this->GetLeftOrDefault(current);
145 current = this->GetRightOrDefault(current);
157 current = this->GetNext(current);
158 if (current == 0 || this->
object().GetBasePartValue(current) != link)
183 return LinkType{linkIndex, link.Source, link.Target};
191 return this->object().FirstIsToTheLeftOfSecond(firstLink.Source, firstLink.Target, secondLink.Source,
200 return this->object().FirstIsToTheRightOfSecond(firstLink.Source, firstLink.Target, secondLink.Source,
207 return Platform::Numbers::Bit::PartialRead<LinkAddressType>(value, 5, -5);
213 *storedValue = Platform::Numbers::Bit::PartialWrite<LinkAddressType>(*storedValue, size, 5, -5);
220 return (
bool)Platform::Numbers::Bit::PartialRead<LinkAddressType>(value, 4, 1);
228 auto previousValue = *storedValue;
230 Platform::Numbers::Bit::PartialWrite<LinkAddressType>(previousValue, (
LinkAddressType)value, 4, 1);
231 *storedValue = modified;
239 return (
bool)Platform::Numbers::Bit::PartialRead<LinkAddressType>(value, 3, 1);
247 auto previousValue = *storedValue;
249 Platform::Numbers::Bit::PartialWrite<LinkAddressType>(previousValue, (
LinkAddressType)value, 3, 1);
250 *storedValue = modified;
257 auto parentSize = this->GetSize(parent);
258 auto childSize = this->GetSizeOrZero(possibleChild);
259 return childSize > 0 && (childSize <= parentSize);
266 auto value = (std::int32_t)Platform::Numbers::Bit::PartialRead<LinkAddressType>(storedValue, 0, 3);
267 value |= 0xF8 * ((value & 4) >> 2);
268 return (std::int8_t)value;
276 auto packagedValue = (
LinkAddressType)((((std::uint8_t)value >> 5) & 4) | (value & 3));
278 Platform::Numbers::Bit::PartialWrite<LinkAddressType>(*storedValue, packagedValue, 0, 3);
279 *storedValue = modified;