public void replaceAll(String regex, String replacement, int column) { checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column]; for (int row = 0; row < rowCount; row++) { if (stringData[row] != null) { stringData[row] = stringData[row].replaceAll(regex, replacement); } } } else { throw new IllegalArgumentException("replaceAll() can only be used on String columns"); } }
public void replaceAll(String regex, String replacement, int column) { checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column]; for (int row = 0; row < rowCount; row++) { if (stringData[row] != null) { stringData[row] = stringData[row].replaceAll(regex, replacement); } } } else { throw new IllegalArgumentException("replaceAll() can only be used on String columns"); } }
/** Throw an error if this entry is out of bounds. */ protected void checkBounds(int row, int column) { checkRow(row); checkColumn(column); }
/** Throw an error if this entry is out of bounds. */ protected void checkBounds(int row, int column) { checkRow(row); checkColumn(column); }
checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column];
checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column];
int count = 0; checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column];
int count = 0; checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column];
/** * Return the row that contains the first String that matches. * @param regexp the String to match * @param column ID number of the column to search */ public int matchRowIndex(String regexp, int column) { checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column]; for (int row = 0; row < rowCount; row++) { if (stringData[row] != null && PApplet.match(stringData[row], regexp) != null) { return row; } } } else { // less efficient, includes conversion as necessary for (int row = 0; row < rowCount; row++) { String str = getString(row, column); if (str != null && PApplet.match(str, regexp) != null) { return row; } } } return -1; }
/** * Return the row that contains the first String that matches. * @param regexp the String to match * @param column ID number of the column to search */ public int matchRowIndex(String regexp, int column) { checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column]; for (int row = 0; row < rowCount; row++) { if (stringData[row] != null && PApplet.match(stringData[row], regexp) != null) { return row; } } } else { // less efficient, includes conversion as necessary for (int row = 0; row < rowCount; row++) { String str = getString(row, column); if (str != null && PApplet.match(str, regexp) != null) { return row; } } } return -1; }
/** * 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 */ public int[] matchRowIndices(String regexp, int column) { int[] outgoing = new int[rowCount]; int count = 0; checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column]; for (int row = 0; row < rowCount; row++) { if (stringData[row] != null && PApplet.match(stringData[row], regexp) != null) { outgoing[count++] = row; } } } else { // less efficient, includes conversion as necessary for (int row = 0; row < rowCount; row++) { String str = getString(row, column); if (str != null && PApplet.match(str, regexp) != null) { outgoing[count++] = row; } } } return PApplet.subset(outgoing, 0, count); }
/** * 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 what the String to match * @param column ID number of the column to search */ public int[] matchRowIndices(String regexp, int column) { int[] outgoing = new int[rowCount]; int count = 0; checkColumn(column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column]; for (int row = 0; row < rowCount; row++) { if (stringData[row] != null && PApplet.match(stringData[row], regexp) != null) { outgoing[count++] = row; } } } else { // less efficient, includes conversion as necessary for (int row = 0; row < rowCount; row++) { String str = getString(row, column); if (str != null && PApplet.match(str, regexp) != null) { outgoing[count++] = row; } } } return PApplet.subset(outgoing, 0, count); }