public long getLong(int row, int column) { checkBounds(row, column); if (columnTypes[column] == LONG) { long[] longData = (long[]) columns[column]; return longData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingLong; } try { return Long.parseLong(str); } catch (NumberFormatException nfe) { return missingLong; } }
public long getLong(int row, int column) { checkBounds(row, column); if (columnTypes[column] == LONG) { long[] longData = (long[]) columns[column]; return longData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingLong; } try { return Long.parseLong(str); } catch (NumberFormatException nfe) { return missingLong; } }
public double getDouble(int row, int column) { checkBounds(row, column); if (columnTypes[column] == DOUBLE) { double[] doubleData = (double[]) columns[column]; return doubleData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingDouble; } try { return Double.parseDouble(str); } catch (NumberFormatException nfe) { return missingDouble; } }
public double getDouble(int row, int column) { checkBounds(row, column); if (columnTypes[column] == DOUBLE) { double[] doubleData = (double[]) columns[column]; return doubleData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingDouble; } try { return Double.parseDouble(str); } catch (NumberFormatException nfe) { return missingDouble; } }
/** * @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 * @see Table#getFloat(int, int) * @see Table#getString(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ public int getInt(int row, int column) { checkBounds(row, column); if (columnTypes[column] == INT || columnTypes[column] == CATEGORY) { int[] intData = (int[]) columns[column]; return intData[row]; } String str = getString(row, column); return (str == null || str.equals(missingString)) ? missingInt : PApplet.parseInt(str, missingInt); }
/** * Get a String value from the table. If the row is longer than the table * * @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 * @see Table#getInt(int, int) * @see Table#getFloat(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ 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[column] == CATEGORY) { int cat = getInt(row, column); if (cat == missingCategory) { return missingString; } return columnCategories[column].key(cat); } else { return String.valueOf(Array.get(columns[column], row)); } }
/** * @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 * @see Table#getFloat(int, int) * @see Table#getString(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ public int getInt(int row, int column) { checkBounds(row, column); if (columnTypes[column] == INT || columnTypes[column] == CATEGORY) { int[] intData = (int[]) columns[column]; return intData[row]; } String str = getString(row, column); return (str == null || str.equals(missingString)) ? missingInt : PApplet.parseInt(str, missingInt); }
/** * 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 * @see Table#getInt(int, int) * @see Table#getString(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ public float getFloat(int row, int column) { checkBounds(row, column); if (columnTypes[column] == FLOAT) { float[] floatData = (float[]) columns[column]; return floatData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingFloat; } return PApplet.parseFloat(str, missingFloat); }
/** * 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 * @see Table#getInt(int, int) * @see Table#getString(int, int) * @see Table#getStringColumn(String) * @see Table#setInt(int, int, int) * @see Table#setFloat(int, int, float) * @see Table#setString(int, int, String) */ public float getFloat(int row, int column) { checkBounds(row, column); if (columnTypes[column] == FLOAT) { float[] floatData = (float[]) columns[column]; return floatData[row]; } String str = getString(row, column); if (str == null || str.equals(missingString)) { return missingFloat; } return PApplet.parseFloat(str, missingFloat); }
checkBounds(row, column); if (columnTypes[column] == STRING) { String[] stringData = (String[]) columns[column];