Returns the distance of the specified node. @param pre PRE value @param kind node kind @return distance
(final int pre, final int kind)
| 329 | * @return distance |
| 330 | */ |
| 331 | public final int dist(final int pre, final int kind) { |
| 332 | return switch(kind) { |
| 333 | case ELEM -> table.read4(pre, 4); |
| 334 | case TEXT, COMM, PI -> table.read4(pre, 8); |
| 335 | case ATTR -> { |
| 336 | int d = table.read1(pre, 0) >> 3 & IO.MAXATTS; |
| 337 | // skip additional attributes if value is larger than maximum range |
| 338 | if(d == IO.MAXATTS) while(d < pre && kind(pre - d) == ATTR) d++; |
| 339 | yield d; |
| 340 | } |
| 341 | default -> pre + 1; |
| 342 | }; |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * Returns the size value (number of descendant table entries). |
no test coverage detected