Returns the first node in the tree that is in range.
()
| 369 | */ |
| 370 | |
| 371 | @Nullable |
| 372 | private AvlNode<E> firstNode() { |
| 373 | AvlNode<E> root = rootReference.get(); |
| 374 | if (root == null) { |
| 375 | return null; |
| 376 | } |
| 377 | AvlNode<E> node; |
| 378 | if (range.hasLowerBound()) { |
| 379 | E endpoint = range.getLowerEndpoint(); |
| 380 | node = rootReference.get().ceiling(comparator(), endpoint); |
| 381 | if (node == null) { |
| 382 | return null; |
| 383 | } |
| 384 | |
| 385 | if (range.getLowerBoundType() == BoundType.OPEN |
| 386 | && comparator().compare(endpoint, node.getElement()) == 0) { |
| 387 | node = node.succ; |
| 388 | } |
| 389 | } else { |
| 390 | node = header.succ; |
| 391 | } |
| 392 | return (node == header || !range.contains(node.getElement())) ? null : node; |
| 393 | } |
| 394 | |
| 395 | @Nullable |
| 396 | private AvlNode<E> lastNode() { |
no test coverage detected