| 51 | } |
| 52 | |
| 53 | bool Ordering::IsSuborderOf(const Ordering& other) const { |
| 54 | if (sort_keys_.empty()) { |
| 55 | // The implicit ordering is a subordering of nothing. The unordered ordering |
| 56 | // is a subordering of everything |
| 57 | return !is_implicit_; |
| 58 | } |
| 59 | if (null_placement_ != other.null_placement_) { |
| 60 | return false; |
| 61 | } |
| 62 | if (sort_keys_.size() > other.sort_keys_.size()) { |
| 63 | return false; |
| 64 | } |
| 65 | for (std::size_t key_idx = 0; key_idx < sort_keys_.size(); key_idx++) { |
| 66 | if (!sort_keys_[key_idx].Equals(other.sort_keys_[key_idx])) { |
| 67 | return false; |
| 68 | } |
| 69 | } |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | bool Ordering::Equals(const Ordering& other) const { |
| 74 | return null_placement_ == other.null_placement_ && sort_keys_ == other.sort_keys_; |