/** * Add a given number of rows to this table. All data columns will be * notified and will take on the appropriate default values for the * added rows. * @param nrows the number of rows to add. */ public void addRows(int nrows) { for ( int i=0; i<nrows; ++i ) { addRow(); } }
/** * @see prefuse.data.Table#addRow() */ public int addRow() { if ( m_parent != null ) { throw new IllegalStateException( "Add row not supported for CascadedTable."); } else { return super.addRow(); } }
/** * Add row to the node table, thereby adding a node to the graph. * @return the node id (node table row number) of the added node */ public int addNodeRow() { return getNodeTable().addRow(); }
/** * Update the link table to accomodate an inserted or deleted node * @param r the node id, also the row number into the link table * @param added indicates if a node was added or removed */ protected void updateNodeData(int r, boolean added) { if ( added ) { m_links.addRow(); } else { m_nodeTuples.invalidate(r); m_links.removeRow(r); } }
/** * Adds a row. * @return number of rows */ public int addRow() { try { if (this.canAddRow()) { int r = this.table.addRow(); this.fireTableEvent(r, r, TableListener.ALL_COLUMN, TableListener.INSERT); return r; } else { return -1; } } catch (Exception e) { throw new ObviousRuntimeException(e); } }
row = t.addRow();
/** * Add an item to the aggregation at the given row. * @param row the row index of the aggregate * @param member the item to add to the aggregation */ public void addToAggregate(int row, VisualItem member) { validRowCheck(row, true); if ( !aggregateContains(row, member) ) { int ar = m_aggregated.addRow(); m_aggregated.setInt(ar, AGGREGATE, row); m_aggregated.setInt(ar, MEMBER_HASH, getHashCode(member)); m_aggregated.set(ar, MEMBER, member); fireTableEvent(row, row, EventConstants.ALL_COLUMNS, EventConstants.UPDATE); } }
protected void addAxisNames() { Table textlabels_table = new Table(); textlabels_table.addColumn("label",String.class); textlabels_table.addColumn("type",String.class); textlabels_table.addRow(); textlabels_table.setString(0,"label","Time/s"); textlabels_table.setString(0,"type","xaxisname"); VisualTable textlabelsviz = this.viz.addTable(labelgroup, textlabels_table); textlabelsviz.setX(0,SIZE_X/2d); textlabelsviz.setY(0,SIZE_Y - BORDER[2] + (BORDER[2]*0.1)); textlabelsviz.setTextColor(0,ColorLib.color(java.awt.Color.GRAY)); textlabelsviz.setFont(0,new Font(Font.SANS_SERIF,Font.PLAIN,AXIS_NAME_FONT_SIZE)); }
/** * Add an edge to the graph. Both multiple edges between two nodes * and edges from a node to itself are allowed. * @param s the source node id * @param t the target node id * @return the edge id (edge table row number) of the added edge */ public int addEdge(int s, int t) { // get keys for the nodes long key1 = getKey(s); long key2 = getKey(t); // add edge row, set source/target fields Table edges = getEdgeTable(); int r = edges.addRow(); if ( m_longKey ) { edges.setLong(r, m_skey, key1); edges.setLong(r, m_tkey, key2); } else { edges.setInt(r, m_skey, (int)key1); edges.setInt(r, m_tkey, (int)key2); } return r; }
public void populateTable_OneLinePerState(Table orig_tab) { IntIterator rownumiter; int newrownum, origrownum; rownumiter = orig_tab.rows(); // iterate over everything while (rownumiter.hasNext()) { origrownum = ((Integer)rownumiter.next()).intValue(); newrownum = this.plot_tab.addRow(); this.plot_tab.set(newrownum, "state_name", orig_tab.getString(origrownum, "state_name")); this.plot_tab.set(newrownum, "ycoord", orig_tab.getInt(origrownum, "seqno")); this.plot_tab.set(newrownum,"hostname",orig_tab.getString(origrownum,"hostname")); this.plot_tab.set(newrownum,"friendly_id",orig_tab.getString(origrownum,"friendly_id")); this.plot_tab.set(newrownum,START_FIELD_NAME, orig_tab.getDouble(origrownum,START_FIELD_NAME)); this.plot_tab.set(newrownum,END_FIELD_NAME, orig_tab.getDouble(origrownum,END_FIELD_NAME)); } }
/** * Adds a row to the table (tuple). * @param tuple tuple to insert in the table. * @return row count */ public int addRow(Tuple tuple) { try { this.beginEdit(TableListener.ALL_COLUMN); int r = table.addRow(); for (int i = 0; i < tuple.getSchema().getColumnCount(); i++) { this.set(r, tuple.getSchema().getColumnName(i), tuple.get(i)); } this.endEdit(TableListener.ALL_COLUMN); this.fireTableEvent(r, r, TableListener.ALL_COLUMN, TableListener.INSERT); return r; } catch (Exception e) { throw new ObviousRuntimeException(e); } }
Schema s = t.getSchema(); if ( getSchema().isAssignableFrom(s) ) { int r = addRow(); for ( int i=0; i<s.getColumnCount(); ++i ) { String field = s.getColumnName(i);
public void populateTable_MapsReducesOnly(Table orig_tab) { IntIterator rownumiter; int newrownum, origrownum; rownumiter = orig_tab.rows( (Predicate) ExpressionParser.parse("[state_name] == 'map' OR [state_name] == 'reduce'") ); while (rownumiter.hasNext()) { origrownum = ((Integer)rownumiter.next()).intValue(); newrownum = this.plot_tab.addRow(); this.plot_tab.set(newrownum, "state_name", orig_tab.getString(origrownum, "state_name")); this.plot_tab.set(newrownum, "ycoord", orig_tab.getInt(origrownum, "seqno")); this.plot_tab.set(newrownum,"hostname",orig_tab.getString(origrownum,"hostname")); this.plot_tab.set(newrownum,"friendly_id",orig_tab.getString(origrownum,"friendly_id")); this.plot_tab.set(newrownum,START_FIELD_NAME, orig_tab.getDouble(origrownum,START_FIELD_NAME)); this.plot_tab.set(newrownum,START_FIELD_NAME, orig_tab.getDouble(origrownum,END_FIELD_NAME)); } }