Skip to content

Commit 4896acd

Browse files
author
Scott Murray
committed
Added reference for Table getInt(), getFloat(), getString(), setInt(), setFloat(), setString()
1 parent f277336 commit 4896acd

File tree

1 file changed

+74
-28
lines changed

1 file changed

+74
-28
lines changed

core/src/processing/data/Table.java

Lines changed: 74 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ public void insertRow(int insert, Object[] columnData) {
18161816
/**
18171817
* @webref table:method
18181818
* @brief Removes a row from the table
1819-
* @param row ID value of the row to remove
1819+
* @param row ID number of the row to remove
18201820
*/
18211821
public void removeRow(int row) {
18221822
for (int col = 0; col < columns.length; col++) {
@@ -2015,7 +2015,7 @@ protected void setRowCol(int row, int col, Object piece) {
20152015
/**
20162016
* @webref table:method
20172017
* @brief Gets a row from the table
2018-
* @param row ID value of the row to get
2018+
* @param row ID number of the row to get
20192019
*/
20202020
public TableRow getRow(int row) {
20212021
return new RowPointer(this, row);
@@ -2384,6 +2384,12 @@ public void remove() {
23842384
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23852385

23862386

2387+
/**
2388+
* @webref table:method
2389+
* @brief Get an integer value from the specified row and column
2390+
* @param row ID number of the row to reference
2391+
* @param column ID number of the column to reference
2392+
*/
23872393
public int getInt(int row, int column) {
23882394
checkBounds(row, column);
23892395
if (columnTypes[column] == INT ||
@@ -2396,7 +2402,9 @@ public int getInt(int row, int column) {
23962402
missingInt : PApplet.parseInt(str, missingInt);
23972403
}
23982404

2399-
2405+
/**
2406+
* @param columnName title of the column to reference
2407+
*/
24002408
public int getInt(int row, String columnName) {
24012409
return getInt(row, getColumnIndex(columnName));
24022410
}
@@ -2407,6 +2415,13 @@ public void setMissingInt(int value) {
24072415
}
24082416

24092417

2418+
/**
2419+
* @webref table:method
2420+
* @brief Store an integer value in the specified row and column
2421+
* @param row ID number of the target row
2422+
* @param column ID number of the target column
2423+
* @param value value to assign
2424+
*/
24102425
public void setInt(int row, int column, int value) {
24112426
if (columnTypes[column] == STRING) {
24122427
setString(row, column, String.valueOf(value));
@@ -2422,7 +2437,9 @@ public void setInt(int row, int column, int value) {
24222437
}
24232438
}
24242439

2425-
2440+
/**
2441+
* @param columnName title of the target column
2442+
*/
24262443
public void setInt(int row, String columnName, int value) {
24272444
setInt(row, getColumnIndex(columnName), value);
24282445
}
@@ -2535,6 +2552,11 @@ public long[] getLongRow(int row) {
25352552
* Get a float value from the specified row and column. If the value is null
25362553
* or not parseable as a float, the "missing" value is returned. By default,
25372554
* this is Float.NaN, but can be controlled with setMissingFloat().
2555+
*
2556+
* @webref table:method
2557+
* @brief Get a float value from the specified row and column
2558+
* @param row ID number of the row to reference
2559+
* @param column ID number of the column to reference
25382560
*/
25392561
public float getFloat(int row, int column) {
25402562
checkBounds(row, column);
@@ -2549,7 +2571,9 @@ public float getFloat(int row, int column) {
25492571
return PApplet.parseFloat(str, missingFloat);
25502572
}
25512573

2552-
2574+
/**
2575+
* @param columnName title of the column to reference
2576+
*/
25532577
public float getFloat(int row, String columnName) {
25542578
return getFloat(row, getColumnIndex(columnName));
25552579
}
@@ -2560,6 +2584,13 @@ public void setMissingFloat(float value) {
25602584
}
25612585

25622586

2587+
/**
2588+
* @webref table:method
2589+
* @brief Store a float value in the specified row and column
2590+
* @param row ID number of the target row
2591+
* @param column ID number of the target column
2592+
* @param value value to assign
2593+
*/
25632594
public void setFloat(int row, int column, float value) {
25642595
if (columnTypes[column] == STRING) {
25652596
setString(row, column, String.valueOf(value));
@@ -2574,7 +2605,9 @@ public void setFloat(int row, int column, float value) {
25742605
}
25752606
}
25762607

2577-
2608+
/**
2609+
* @param columnName title of the target column
2610+
*/
25782611
public void setFloat(int row, String columnName, float value) {
25792612
setFloat(row, getColumnIndex(columnName), value);
25802613
}
@@ -2740,27 +2773,31 @@ public double[] getDoubleRow(int row) {
27402773

27412774
/**
27422775
* Get a String value from the table. If the row is longer than the table
2743-
* @param row
2744-
* @param col
2745-
* @return the String defined by the row and col variables
2776+
*
2777+
* @webref table:method
2778+
* @brief Get an String value from the specified row and column
2779+
* @param row ID number of the row to reference
2780+
* @param column ID number of the column to reference
27462781
*/
2747-
public String getString(int row, int col) {
2748-
checkBounds(row, col);
2749-
if (columnTypes[col] == STRING) {
2750-
String[] stringData = (String[]) columns[col];
2782+
public String getString(int row, int column) {
2783+
checkBounds(row, column);
2784+
if (columnTypes[column] == STRING) {
2785+
String[] stringData = (String[]) columns[column];
27512786
return stringData[row];
2752-
} else if (columnTypes[col] == CATEGORY) {
2753-
int cat = getInt(row, col);
2787+
} else if (columnTypes[column] == CATEGORY) {
2788+
int cat = getInt(row, column);
27542789
if (cat == missingCategory) {
27552790
return missingString;
27562791
}
2757-
return columnCategories[col].key(cat);
2792+
return columnCategories[column].key(cat);
27582793
} else {
2759-
return String.valueOf(Array.get(columns[col], row));
2794+
return String.valueOf(Array.get(columns[column], row));
27602795
}
27612796
}
27622797

2763-
2798+
/**
2799+
* @param columnName title of the column to reference
2800+
*/
27642801
public String getString(int row, String columnName) {
27652802
return getString(row, getColumnIndex(columnName));
27662803
}
@@ -2771,6 +2808,13 @@ public void setMissingString(String value) {
27712808
}
27722809

27732810

2811+
/**
2812+
* @webref table:method
2813+
* @brief Store a String value in the specified row and column
2814+
* @param row ID number of the target row
2815+
* @param column ID number of the target column
2816+
* @param value value to assign
2817+
*/
27742818
public void setString(int row, int column, String value) {
27752819
ensureBounds(row, column);
27762820
if (columnTypes[column] != STRING) {
@@ -2780,7 +2824,9 @@ public void setString(int row, int column, String value) {
27802824
stringData[row] = value;
27812825
}
27822826

2783-
2827+
/**
2828+
* @param columnName title of the target column
2829+
*/
27842830
public void setString(int row, String columnName, String value) {
27852831
int column = checkColumnIndex(columnName);
27862832
setString(row, column, value);
@@ -2820,7 +2866,7 @@ public String[] getStringRow(int row) {
28202866
/**
28212867
* Return the row that contains the first String that matches.
28222868
* @param value the String to match
2823-
* @param column the column to search
2869+
* @param column ID number of the column to search
28242870
*/
28252871
public int findRowIndex(String value, int column) {
28262872
checkColumn(column);
@@ -2856,7 +2902,7 @@ public int findRowIndex(String value, int column) {
28562902
/**
28572903
* Return the row that contains the first String that matches.
28582904
* @param value the String to match
2859-
* @param columnName the column to search
2905+
* @param columnName title of the column to search
28602906
*/
28612907
public int findRowIndex(String value, String columnName) {
28622908
return findRowIndex(value, getColumnIndex(columnName));
@@ -2867,7 +2913,7 @@ public int findRowIndex(String value, String columnName) {
28672913
* Return a list of rows that contain the String passed in. If there are no
28682914
* matches, a zero length array will be returned (not a null array).
28692915
* @param value the String to match
2870-
* @param column the column to search
2916+
* @param column ID number of the column to search
28712917
*/
28722918
public int[] findRowIndices(String value, int column) {
28732919
int[] outgoing = new int[rowCount];
@@ -2909,7 +2955,7 @@ public int[] findRowIndices(String value, int column) {
29092955
* Return a list of rows that contain the String passed in. If there are no
29102956
* matches, a zero length array will be returned (not a null array).
29112957
* @param value the String to match
2912-
* @param columnName the column to search
2958+
* @param columnName title of the column to search
29132959
*/
29142960
public int[] findRowIndices(String value, String columnName) {
29152961
return findRowIndices(value, getColumnIndex(columnName));
@@ -2960,7 +3006,7 @@ public Iterator<TableRow> findRows(String value, String columnName) {
29603006
/**
29613007
* Return the row that contains the first String that matches.
29623008
* @param regexp the String to match
2963-
* @param column the column to search
3009+
* @param column ID number of the column to search
29643010
*/
29653011
public int matchRowIndex(String regexp, int column) {
29663012
checkColumn(column);
@@ -2988,7 +3034,7 @@ public int matchRowIndex(String regexp, int column) {
29883034
/**
29893035
* Return the row that contains the first String that matches.
29903036
* @param what the String to match
2991-
* @param columnName the column to search
3037+
* @param columnName title of the column to search
29923038
*/
29933039
public int matchRowIndex(String what, String columnName) {
29943040
return matchRowIndex(what, getColumnIndex(columnName));
@@ -2999,7 +3045,7 @@ public int matchRowIndex(String what, String columnName) {
29993045
* Return a list of rows that contain the String passed in. If there are no
30003046
* matches, a zero length array will be returned (not a null array).
30013047
* @param what the String to match
3002-
* @param column the column to search
3048+
* @param column ID number of the column to search
30033049
*/
30043050
public int[] matchRowIndices(String regexp, int column) {
30053051
int[] outgoing = new int[rowCount];
@@ -3031,7 +3077,7 @@ public int[] matchRowIndices(String regexp, int column) {
30313077
* Return a list of rows that match the regex passed in. If there are no
30323078
* matches, a zero length array will be returned (not a null array).
30333079
* @param what the String to match
3034-
* @param columnName the column to search
3080+
* @param columnName title of the column to search
30353081
*/
30363082
public int[] matchRowIndices(String what, String columnName) {
30373083
return matchRowIndices(what, getColumnIndex(columnName));
@@ -3139,7 +3185,7 @@ public void replaceAll(String regex, String replacement, int column) {
31393185
* Run String.replaceAll() on all entries in a column.
31403186
* Only works with columns that are already String values.
31413187
* @param what the String to match
3142-
* @param columnName the column to search
3188+
* @param columnName title of the column to search
31433189
*/
31443190
public void replaceAll(String regex, String replacement, String columnName) {
31453191
replaceAll(regex, replacement, getColumnIndex(columnName));

0 commit comments

Comments
 (0)