Mercurial > octave
comparison src/ov-cell.cc @ 8823:3efa512a0957
make issorted work for cells
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 20 Feb 2009 07:44:48 +0100 |
parents | af907aeedbf4 |
children | 76ddf0ab985d |
comparison
equal
deleted
inserted
replaced
8822:40ff50ce3052 | 8823:3efa512a0957 |
---|---|
481 error ("sort: only cell arrays of character strings may be sorted"); | 481 error ("sort: only cell arrays of character strings may be sorted"); |
482 | 482 |
483 return retval; | 483 return retval; |
484 } | 484 } |
485 | 485 |
486 sortmode | |
487 octave_cell::is_sorted (sortmode mode) const | |
488 { | |
489 sortmode retval = UNSORTED; | |
490 | |
491 if (is_cellstr ()) | |
492 { | |
493 Array<std::string> tmp = cellstr_value (); | |
494 | |
495 retval = tmp.is_sorted (mode); | |
496 } | |
497 else | |
498 error ("issorted: not a cell array of strings"); | |
499 | |
500 return retval; | |
501 } | |
502 | |
503 | |
486 Array<octave_idx_type> | 504 Array<octave_idx_type> |
487 octave_cell::sort_rows_idx (sortmode mode) const | 505 octave_cell::sort_rows_idx (sortmode mode) const |
488 { | 506 { |
489 Array<octave_idx_type> retval; | 507 Array<octave_idx_type> retval; |
490 | 508 |
494 | 512 |
495 retval = tmp.sort_rows_idx (mode); | 513 retval = tmp.sort_rows_idx (mode); |
496 } | 514 } |
497 else | 515 else |
498 error ("sortrows: only cell arrays of character strings may be sorted"); | 516 error ("sortrows: only cell arrays of character strings may be sorted"); |
517 | |
518 return retval; | |
519 } | |
520 | |
521 sortmode | |
522 octave_cell::is_sorted_rows (sortmode mode) const | |
523 { | |
524 sortmode retval = UNSORTED; | |
525 | |
526 if (is_cellstr ()) | |
527 { | |
528 Array<std::string> tmp = cellstr_value (); | |
529 | |
530 retval = tmp.is_sorted_rows (mode); | |
531 } | |
532 else | |
533 error ("issorted: not a cell array of strings"); | |
499 | 534 |
500 return retval; | 535 return retval; |
501 } | 536 } |
502 | 537 |
503 bool | 538 bool |