MCPcopy Index your code
hub / github.com/benfry/processing4 / matchRowIndices

Method matchRowIndices

core/src/processing/data/Table.java:3884–3907  ·  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 regexp the String to match @param column ID number of the column to search

(String regexp, int column)

Source from the content-addressed store, hash-verified

3882 * @param column ID number of the column to search
3883 */
3884 public int[] matchRowIndices(String regexp, int column) {
3885 int[] outgoing = new int[rowCount];
3886 int count = 0;
3887
3888 checkColumn(column);
3889 if (columnTypes[column] == STRING) {
3890 String[] stringData = (String[]) columns[column];
3891 for (int row = 0; row < rowCount; row++) {
3892 if (stringData[row] != null &&
3893 PApplet.match(stringData[row], regexp) != null) {
3894 outgoing[count++] = row;
3895 }
3896 }
3897 } else { // less efficient, includes conversion as necessary
3898 for (int row = 0; row < rowCount; row++) {
3899 String str = getString(row, column);
3900 if (str != null &&
3901 PApplet.match(str, regexp) != null) {
3902 outgoing[count++] = row;
3903 }
3904 }
3905 }
3906 return PApplet.subset(outgoing, 0, count);
3907 }
3908
3909
3910 /**

Callers 1

matchRowIteratorMethod · 0.95

Calls 5

checkColumnMethod · 0.95
matchMethod · 0.95
getStringMethod · 0.95
subsetMethod · 0.95
getColumnIndexMethod · 0.95

Tested by

no test coverage detected