MCPcopy Create free account
hub / github.com/catboost/catboost / NextNode

Method NextNode

library/cpp/containers/comptrie/minimize.cpp:174–202  ·  view source on GitHub ↗

NextNode returns child nodes, starting from the last node: Right, then Left, then Forward

Source from the content-addressed store, hash-verified

172
173 // NextNode returns child nodes, starting from the last node: Right, then Left, then Forward
174 size_t NextNode(const TOffsetMap& mergedNodes) {
175 while (Selector < 3) {
176 size_t nextOffset = 0;
177
178 switch (++Selector) {
179 case 1:
180 if (Node.GetRightOffset())
181 nextOffset = Node.GetRightOffset();
182 break;
183
184 case 2:
185 if (Node.GetLeftOffset())
186 nextOffset = Node.GetLeftOffset();
187 break;
188
189 case 3:
190 if (Node.GetForwardOffset())
191 nextOffset = Node.GetForwardOffset();
192 break;
193
194 default:
195 break;
196 }
197
198 if (nextOffset && !mergedNodes.Contains(nextOffset))
199 return nextOffset;
200 }
201 return 0;
202 }
203 };
204
205 class TMergingReverseNodeEnumerator: public TReverseNodeEnumerator {

Callers 1

MoveMethod · 0.80

Calls 4

GetRightOffsetMethod · 0.80
GetLeftOffsetMethod · 0.80
GetForwardOffsetMethod · 0.80
ContainsMethod · 0.45

Tested by

no test coverage detected