| 410 | } |
| 411 | |
| 412 | int MinorKey::compare (const MinorKey& that) const |
| 413 | { |
| 414 | /* compare by rowKeys first; in case of equality, use columnKeys */ |
| 415 | if (this->getNumberOfRowBlocks() < that.getNumberOfRowBlocks()) |
| 416 | return -1; |
| 417 | if (this->getNumberOfRowBlocks() > that.getNumberOfRowBlocks()) |
| 418 | return 1; |
| 419 | /* Here, numbers of rows are equal. */ |
| 420 | for (int r = this->getNumberOfRowBlocks() - 1; r >= 0; r--) |
| 421 | { |
| 422 | if (this->getRowKey(r) < that.getRowKey(r)) return -1; |
| 423 | if (this->getRowKey(r) > that.getRowKey(r)) return 1; |
| 424 | } |
| 425 | /* Here, this and that encode ecaxtly the same sets of rows. |
| 426 | Now, we take a look at the columns. */ |
| 427 | if (this->getNumberOfColumnBlocks() < that.getNumberOfColumnBlocks()) |
| 428 | return -1; |
| 429 | if (this->getNumberOfColumnBlocks() > that.getNumberOfColumnBlocks()) |
| 430 | return 1; |
| 431 | /* Here, numbers of columns are equal. */ |
| 432 | for (int c = this->getNumberOfColumnBlocks() - 1; c >= 0; c--) |
| 433 | { |
| 434 | if (this->getColumnKey(c) < that.getColumnKey(c)) return -1; |
| 435 | if (this->getColumnKey(c) > that.getColumnKey(c)) return 1; |
| 436 | } |
| 437 | /* Here, this and that encode exactly the same sets of rows and columns. */ |
| 438 | return 0; |
| 439 | } |
| 440 | |
| 441 | /* just to make the compiler happy; |
| 442 | this method should never be called */ |
no test coverage detected