Return the row that contains the first String that matches. @param value the String to match @param column ID number of the column to search
(String value, int column)
| 3658 | * @param column ID number of the column to search |
| 3659 | */ |
| 3660 | public int findRowIndex(String value, int column) { |
| 3661 | checkColumn(column); |
| 3662 | if (columnTypes[column] == STRING) { |
| 3663 | String[] stringData = (String[]) columns[column]; |
| 3664 | if (value == null) { |
| 3665 | for (int row = 0; row < rowCount; row++) { |
| 3666 | if (stringData[row] == null) return row; |
| 3667 | } |
| 3668 | } else { |
| 3669 | for (int row = 0; row < rowCount; row++) { |
| 3670 | if (stringData[row] != null && stringData[row].equals(value)) { |
| 3671 | return row; |
| 3672 | } |
| 3673 | } |
| 3674 | } |
| 3675 | } else { // less efficient, includes conversion as necessary |
| 3676 | for (int row = 0; row < rowCount; row++) { |
| 3677 | String str = getString(row, column); |
| 3678 | if (str == null) { |
| 3679 | if (value == null) { |
| 3680 | return row; |
| 3681 | } |
| 3682 | } else if (str.equals(value)) { |
| 3683 | return row; |
| 3684 | } |
| 3685 | } |
| 3686 | } |
| 3687 | return -1; |
| 3688 | } |
| 3689 | |
| 3690 | |
| 3691 | /** |
no test coverage detected