MCPcopy Index your code
hub / github.com/processing/processing / findRowIndices

Method findRowIndices

core/src/processing/data/Table.java:3639–3672  ·  view source on GitHub ↗

Return a list of rows that contain the String passed in. If there are no matches, a zero length array will be returned (not a null array). @param value the String to match @param column ID number of the column to search

(String value, int column)

Source from the content-addressed store, hash-verified

3637 * @param column ID number of the column to search
3638 */
3639 public int[] findRowIndices(String value, int column) {
3640 int[] outgoing = new int[rowCount];
3641 int count = 0;
3642
3643 checkColumn(column);
3644 if (columnTypes[column] == STRING) {
3645 String[] stringData = (String[]) columns[column];
3646 if (value == null) {
3647 for (int row = 0; row < rowCount; row++) {
3648 if (stringData[row] == null) {
3649 outgoing[count++] = row;
3650 }
3651 }
3652 } else {
3653 for (int row = 0; row < rowCount; row++) {
3654 if (stringData[row] != null && stringData[row].equals(value)) {
3655 outgoing[count++] = row;
3656 }
3657 }
3658 }
3659 } else { // less efficient, includes conversion as necessary
3660 for (int row = 0; row < rowCount; row++) {
3661 String str = getString(row, column);
3662 if (str == null) {
3663 if (value == null) {
3664 outgoing[count++] = row;
3665 }
3666 } else if (str.equals(value)) {
3667 outgoing[count++] = row;
3668 }
3669 }
3670 }
3671 return PApplet.subset(outgoing, 0, count);
3672 }
3673
3674
3675 /**

Callers 1

findRowIteratorMethod · 0.95

Calls 5

checkColumnMethod · 0.95
getStringMethod · 0.95
subsetMethod · 0.95
getColumnIndexMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected