diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index 01afee0f1..bc770a285 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -1816,7 +1816,7 @@ public class Table { /** * @webref table:method * @brief Removes a row from the table - * @param row ID value of the row to remove + * @param row ID number of the row to remove */ public void removeRow(int row) { for (int col = 0; col < columns.length; col++) { @@ -2015,7 +2015,7 @@ public class Table { /** * @webref table:method * @brief Gets a row from the table - * @param row ID value of the row to get + * @param row ID number of the row to get */ public TableRow getRow(int row) { return new RowPointer(this, row); @@ -2384,6 +2384,12 @@ public class Table { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + /** + * @webref table:method + * @brief Get an integer value from the specified row and column + * @param row ID number of the row to reference + * @param column ID number of the column to reference + */ public int getInt(int row, int column) { checkBounds(row, column); if (columnTypes[column] == INT || @@ -2396,7 +2402,9 @@ public class Table { missingInt : PApplet.parseInt(str, missingInt); } - + /** + * @param columnName title of the column to reference + */ public int getInt(int row, String columnName) { return getInt(row, getColumnIndex(columnName)); } @@ -2407,6 +2415,13 @@ public class Table { } + /** + * @webref table:method + * @brief Store an integer value in the specified row and column + * @param row ID number of the target row + * @param column ID number of the target column + * @param value value to assign + */ public void setInt(int row, int column, int value) { if (columnTypes[column] == STRING) { setString(row, column, String.valueOf(value)); @@ -2422,7 +2437,9 @@ public class Table { } } - + /** + * @param columnName title of the target column + */ public void setInt(int row, String columnName, int value) { setInt(row, getColumnIndex(columnName), value); } @@ -2535,6 +2552,11 @@ public class Table { * Get a float value from the specified row and column. If the value is null * or not parseable as a float, the "missing" value is returned. By default, * this is Float.NaN, but can be controlled with setMissingFloat(). + * + * @webref table:method + * @brief Get a float value from the specified row and column + * @param row ID number of the row to reference + * @param column ID number of the column to reference */ public float getFloat(int row, int column) { checkBounds(row, column); @@ -2549,7 +2571,9 @@ public class Table { return PApplet.parseFloat(str, missingFloat); } - + /** + * @param columnName title of the column to reference + */ public float getFloat(int row, String columnName) { return getFloat(row, getColumnIndex(columnName)); } @@ -2560,6 +2584,13 @@ public class Table { } + /** + * @webref table:method + * @brief Store a float value in the specified row and column + * @param row ID number of the target row + * @param column ID number of the target column + * @param value value to assign + */ public void setFloat(int row, int column, float value) { if (columnTypes[column] == STRING) { setString(row, column, String.valueOf(value)); @@ -2574,7 +2605,9 @@ public class Table { } } - + /** + * @param columnName title of the target column + */ public void setFloat(int row, String columnName, float value) { setFloat(row, getColumnIndex(columnName), value); } @@ -2740,27 +2773,31 @@ public class Table { /** * Get a String value from the table. If the row is longer than the table - * @param row - * @param col - * @return the String defined by the row and col variables + * + * @webref table:method + * @brief Get an String value from the specified row and column + * @param row ID number of the row to reference + * @param column ID number of the column to reference */ - public String getString(int row, int col) { - checkBounds(row, col); - if (columnTypes[col] == STRING) { - String[] stringData = (String[]) columns[col]; + public String getString(int row, int column) { + checkBounds(row, column); + if (columnTypes[column] == STRING) { + String[] stringData = (String[]) columns[column]; return stringData[row]; - } else if (columnTypes[col] == CATEGORY) { - int cat = getInt(row, col); + } else if (columnTypes[column] == CATEGORY) { + int cat = getInt(row, column); if (cat == missingCategory) { return missingString; } - return columnCategories[col].key(cat); + return columnCategories[column].key(cat); } else { - return String.valueOf(Array.get(columns[col], row)); + return String.valueOf(Array.get(columns[column], row)); } } - + /** + * @param columnName title of the column to reference + */ public String getString(int row, String columnName) { return getString(row, getColumnIndex(columnName)); } @@ -2771,6 +2808,13 @@ public class Table { } + /** + * @webref table:method + * @brief Store a String value in the specified row and column + * @param row ID number of the target row + * @param column ID number of the target column + * @param value value to assign + */ public void setString(int row, int column, String value) { ensureBounds(row, column); if (columnTypes[column] != STRING) { @@ -2780,7 +2824,9 @@ public class Table { stringData[row] = value; } - + /** + * @param columnName title of the target column + */ public void setString(int row, String columnName, String value) { int column = checkColumnIndex(columnName); setString(row, column, value); @@ -2820,7 +2866,7 @@ public class Table { /** * Return the row that contains the first String that matches. * @param value the String to match - * @param column the column to search + * @param column ID number of the column to search */ public int findRowIndex(String value, int column) { checkColumn(column); @@ -2856,7 +2902,7 @@ public class Table { /** * Return the row that contains the first String that matches. * @param value the String to match - * @param columnName the column to search + * @param columnName title of the column to search */ public int findRowIndex(String value, String columnName) { return findRowIndex(value, getColumnIndex(columnName)); @@ -2867,7 +2913,7 @@ public class Table { * 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 the column to search + * @param column ID number of the column to search */ public int[] findRowIndices(String value, int column) { int[] outgoing = new int[rowCount]; @@ -2909,7 +2955,7 @@ public class Table { * 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 columnName the column to search + * @param columnName title of the column to search */ public int[] findRowIndices(String value, String columnName) { return findRowIndices(value, getColumnIndex(columnName)); @@ -2960,7 +3006,7 @@ public class Table { /** * Return the row that contains the first String that matches. * @param regexp the String to match - * @param column the column to search + * @param column ID number of the column to search */ public int matchRowIndex(String regexp, int column) { checkColumn(column); @@ -2988,7 +3034,7 @@ public class Table { /** * Return the row that contains the first String that matches. * @param what the String to match - * @param columnName the column to search + * @param columnName title of the column to search */ public int matchRowIndex(String what, String columnName) { return matchRowIndex(what, getColumnIndex(columnName)); @@ -2999,7 +3045,7 @@ public class Table { * 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 the column to search + * @param column ID number of the column to search */ public int[] matchRowIndices(String regexp, int column) { int[] outgoing = new int[rowCount]; @@ -3031,7 +3077,7 @@ public class Table { * Return a list of rows that match the regex 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 columnName the column to search + * @param columnName title of the column to search */ public int[] matchRowIndices(String what, String columnName) { return matchRowIndices(what, getColumnIndex(columnName)); @@ -3139,7 +3185,7 @@ public class Table { * Run String.replaceAll() on all entries in a column. * Only works with columns that are already String values. * @param what the String to match - * @param columnName the column to search + * @param columnName title of the column to search */ public void replaceAll(String regex, String replacement, String columnName) { replaceAll(regex, replacement, getColumnIndex(columnName));