| 79 | } |
| 80 | |
| 81 | void Prev() override { |
| 82 | assert(Valid()); |
| 83 | |
| 84 | // Ensure that all children are positioned before key(). |
| 85 | // If we are moving in the reverse direction, it is already |
| 86 | // true for all of the non-current_ children since current_ is |
| 87 | // the largest child and key() == current_->key(). Otherwise, |
| 88 | // we explicitly position the non-current_ children. |
| 89 | if (direction_ != kReverse) { |
| 90 | for (int i = 0; i < n_; i++) { |
| 91 | IteratorWrapper* child = &children_[i]; |
| 92 | if (child != current_) { |
| 93 | child->Seek(key()); |
| 94 | if (child->Valid()) { |
| 95 | // Child is at first entry >= key(). Step back one to be < key() |
| 96 | child->Prev(); |
| 97 | } else { |
| 98 | // Child has no entries >= key(). Position at last entry. |
| 99 | child->SeekToLast(); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | direction_ = kReverse; |
| 104 | } |
| 105 | |
| 106 | current_->Prev(); |
| 107 | FindLargest(); |
| 108 | } |
| 109 | |
| 110 | Slice key() const override { |
| 111 | assert(Valid()); |
nothing calls this directly
no test coverage detected