int size = table.rows().size(); int[] array = new int[size]; int i = 0; for (TableRow row : table.rows()) { int nums = row.getInt("Column1"); println(nums); array[i] = nums; i++; }
List<Integer> myNums = new ArrayList<>(); for (TableRow row : table.rows()) { int nums = row.getInt("Column1"); myNums.add(nums) println(nums); }
Table data; PShape dataPlot; size(1620, 1080, P2D); //create a group to store the lines from each row dataPlot = createShape(GROUP); //load the data, specifying it has a header and it's tab separated data = loadTable("data.tsv", "header, tsv"); //traverse each row for (TableRow row : data.rows ()) { //extract each value int x1 = row.getInt("x1"); int y1 = row.getInt("y1"); int x2 = row.getInt("x2"); int y2 = row.getInt("y2"); //add the coordinates as lines to the group PShape line = createShape(LINE, x1, y1, x2, y2); float dist = dist(x1, y1, x2, y2); line.setStroke(color(map(dist, 0, height, 160, 0))); line.setStrokeWeight(map(dist, 0, height, 10.0, 1.0)); dataPlot.addChild(line); } //render the plot shape(dataPlot);
public void update(TableRow row) { int idx = var.getIndex(); if (type == Table.INT) { int value = row.getInt(idx); mini = Math.min(mini, value); maxi = Math.max(maxi, value); } else if (type == Table.LONG) { long value = row.getLong(idx); minl = Math.min(minl, value); maxl = Math.max(maxl, value); } else if (type == Table.FLOAT) { float value = row.getFloat(idx); minf = Math.min(minf, value); maxf = Math.max(maxf, value); } else if (type == Table.DOUBLE) { double value = row.getDouble(idx); mind = Math.min(mind, value); maxd = Math.max(maxd, value); } }
Table data; PShape dataPlot; size(1620, 1080,P2D); //create a group to store the lines from each row dataPlot = createShape(); //load the data, specifying it has a header and it's tab separated data = loadTable("data.tsv", "header, tsv"); //traverse each row dataPlot.beginShape(LINES); for(TableRow row : data.rows()){ //extract each value int x1 = row.getInt("x1"); int y1 = row.getInt("y1"); int x2 = row.getInt("x2"); int y2 = row.getInt("y2"); //add the coordinates as lines to the group dataPlot.stroke(160); dataPlot.vertex(x1,y1); dataPlot.stroke(0); dataPlot.vertex(x2,y2); } dataPlot.endShape(); //render the plot shape(dataPlot);
protected double getWeightImpl(TableRow row) { if (type == Table.INT) { return row.getInt(index) ; } else if (type == Table.LONG) { return row.getLong(index); } else if (type == Table.FLOAT) { return row.getFloat(index); } else if (type == Table.DOUBLE) { return row.getDouble(index); } else { return 1d; } }
field.setInt(item, row.getInt(name));
output.writeInt(row.getInt(col)); break; case LONG:
field.setInt(item, row.getInt(name));
output.writeInt(row.getInt(col)); break; case LONG:
public boolean inside(TableRow row) { int idx = var.getIndex(); if (type == Table.INT) { int v = row.getInt(idx); return mini <= v && v <= maxi; } else if (type == Table.LONG) { long v = row.getLong(idx); return minl <= v && v <= maxl; } else if (type == Table.FLOAT) { float v = row.getFloat(idx); return minf <= v && v <= maxf; } else if (type == Table.DOUBLE) { double v = row.getDouble(idx); return mind <= v && v <= maxd; } else { return false; } }
public boolean missing(TableRow row) { boolean miss = true; if (type == Table.INT) { int value = row.getInt(index); miss = value == MISSING_INT || specialValue(value); } else if (type == Table.LONG) { long value = row.getLong(index); miss = value == MISSING_LONG || specialValue(value); } else if (type == Table.FLOAT) { float value = row.getFloat(index); miss = value == MISSING_FLOAT || specialValue(value); } else if (type == Table.DOUBLE) { double value = row.getDouble(index); miss = value == MISSING_DOUBLE || specialValue(value); } return miss; }
case CATEGORY: case INT: setInt(row, col, source.getInt(col)); break; case LONG:
public double getValue(TableRow row, Range sel, boolean normalized) { double value = 0; if (type == Table.INT) { int ivalue = row.getInt(index); if (ivalue == MISSING_INT || specialValue(ivalue)) return -1; value = ivalue;
public String formatValue(TableRow row) { if (type == Table.INT) { int value = row.getInt(index); if (value == MISSING_INT || specialValue(value)) return "missing"; return Numbers.nfc(value); } else if (type == Table.LONG) { long value = row.getLong(index); if (value == MISSING_LONG || specialValue(value)) return "missing"; return Numbers.nfc(value); } else if (type == Table.FLOAT) { float value = row.getFloat(index); if (value == MISSING_FLOAT || specialValue(value)) return "missing"; return Numbers.nfc(value, 2); } else if (type == Table.DOUBLE) { double value = row.getDouble(index); if (value == MISSING_DOUBLE || specialValue(value)) return "missing"; return Numbers.nfc(value, 2); } else { return ""; } }