NextNode returns child nodes, starting from the last node: Right, then Left, then Forward
| 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 { |
no test coverage detected