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

Method setRowCol

core/src/processing/data/Table.java:2606–2684  ·  view source on GitHub ↗
(int row, int col, Object piece)

Source from the content-addressed store, hash-verified

2604
2605
2606 protected void setRowCol(int row, int col, Object piece) {
2607 switch (columnTypes[col]) {
2608 case STRING:
2609 String[] stringData = (String[]) columns[col];
2610 if (piece == null) {
2611 stringData[row] = null;
2612// } else if (piece instanceof String) {
2613// stringData[row] = (String) piece;
2614 } else {
2615 // Calls toString() on the object, which is 'return this' for String
2616 stringData[row] = String.valueOf(piece);
2617 }
2618 break;
2619 case INT:
2620 int[] intData = (int[]) columns[col];
2621 //intData[row] = PApplet.parseInt(piece, missingInt);
2622 if (piece == null) {
2623 intData[row] = missingInt;
2624 } else if (piece instanceof Integer) {
2625 intData[row] = (Integer) piece;
2626 } else {
2627 intData[row] = PApplet.parseInt(String.valueOf(piece), missingInt);
2628 }
2629 break;
2630 case LONG:
2631 long[] longData = (long[]) columns[col];
2632 if (piece == null) {
2633 longData[row] = missingLong;
2634 } else if (piece instanceof Long) {
2635 longData[row] = (Long) piece;
2636 } else {
2637 try {
2638 longData[row] = Long.parseLong(String.valueOf(piece));
2639 } catch (NumberFormatException nfe) {
2640 longData[row] = missingLong;
2641 }
2642 }
2643 break;
2644 case FLOAT:
2645 float[] floatData = (float[]) columns[col];
2646 if (piece == null) {
2647 floatData[row] = missingFloat;
2648 } else if (piece instanceof Float) {
2649 floatData[row] = (Float) piece;
2650 } else {
2651 floatData[row] = PApplet.parseFloat(String.valueOf(piece), missingFloat);
2652 }
2653 break;
2654 case DOUBLE:
2655 double[] doubleData = (double[]) columns[col];
2656 if (piece == null) {
2657 doubleData[row] = missingDouble;
2658 } else if (piece instanceof Double) {
2659 doubleData[row] = (Double) piece;
2660 } else {
2661 try {
2662 doubleData[row] = Double.parseDouble(String.valueOf(piece));
2663 } catch (NumberFormatException nfe) {

Callers 1

setRowMethod · 0.95

Calls 4

parseIntMethod · 0.95
parseFloatMethod · 0.95
equalsMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected