/** * Set the value of a given data field. * @param field the data field to set * @param val the value for the field. If the concrete type of this * Object is not compatible with the underlying data model, an * Exception will be thrown. Use the {@link #canSet(String, Class)} * method to check the type-safety ahead of time. * @see #canSet(String, Class) * @see prefuse.data.Table#getColumnType(String) */ public final void set(String field, Object val) { ++m_modCount; m_table.set(m_cur, field, val); }
t.set(trow, field, rSet.getArray(rCol)); break; case Types.LONGVARBINARY: case Types.VARBINARY: t.set(trow, field, rSet.getBytes(rCol)); break; t.set(trow, field, rSet.getBlob(rCol)); break; t.set(trow, field, rSet.getClob(rCol)); break; t.set(trow, field, rSet.getObject(rCol)); break; t.set(trow, field, rSet.getRef(rCol)); break; default: if ( !m_ignoreUnknownTypes ) { t.set(trow, field, rSet.getObject(rCol));
/** * 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); } }
/** * @see prefuse.data.Tuple#set(java.lang.String, java.lang.Object) */ public final void set(String field, Object value) { validityCheck(); m_table.set(m_row, field, value); }
/** * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) */ public void setValueAt(Object aValue, int rowIndex, int columnIndex) { m_table.set(getRow(rowIndex), columnIndex, aValue); } /**
/** * @see prefuse.data.Tuple#set(int, java.lang.Object) */ public final void set(int idx, Object value) { validityCheck(); m_table.set(m_row, idx, value); }
/** * Internal method for adding a link to an adjacency list * @param field which adjacency list (inlinks or outlinks) to use * @param len the length of the adjacency list * @param n the node id of the adjacency list to use * @param e the edge to add to the list */ protected void addLink(String field, int len, int n, int e) { int[] array = (int[])m_links.get(n, field); if ( array == null ) { array = new int[] {e}; m_links.set(n, field, array); return; } else if ( len == array.length ) { int[] narray = new int[Math.max(3*array.length/2, len+1)]; System.arraycopy(array, 0, narray, 0, array.length); array = narray; m_links.set(n, field, array); } array[len] = e; }
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)); } }
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)); } }
public void endElement(String namespaceURI, String localName, String qName) { if ( qName.equals(DEFAULT) ) { // value is in the buffer m_dflt = m_sbuf.toString(); } else if ( qName.equals(KEY) ) { // time to add to the proper schema(s) addToSchema(); } else if ( qName.equals(DATA) ) { // value is in the buffer String value = m_sbuf.toString(); String name = (String)m_idMap.get(m_key); Class type = m_table.getColumnType(name); try { Object val = parse(value, type); m_table.set(m_row, name, val); } catch ( DataParseException dpe ) { error(dpe); } } else if ( qName.equals(NODE) || qName.equals(EDGE) ) { m_row = -1; m_table = null; } }
public void readValue(int line, int col, String value) throws DataParseException { // early exit on header value if ( line == 1 && m_hasHeader ) return; if ( line != prevLine ) { prevLine = line; ++dim[0]; } dim[1] = col-1; // XXX NOTE-2005.08.29-jheer // For now we use generic routines for filling column values. // This results in the autoboxing of primitive types, slowing // performance a bit and possibly triggering avoidable garbage // collections. If this proves to be a problem down the road, // we can add more nuance later. DataParser dp = di.getParser(dim[1]); table.set(dim[0], dim[1], dp.parse(value)); } };
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)); 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));
/** * Constructor from a prefuse schema instance. * @param prefuseSchema A prefuse schema to wrap around Obvious schema. */ public PrefuseObviousSchema(prefuse.data.Schema prefuseSchema) { this.schema = prefuseSchema; prefuse.data.Table prefuseSchemaTable = new prefuse.data.Table(this.schema.getColumnCount(), SCHEMA_COL_NUMBER); prefuseSchemaTable.addColumn("Name", String.class); prefuseSchemaTable.addColumn("Type", Class.class); prefuseSchemaTable.addColumn("Default Value", Object.class); for (int i = 0; i < this.schema.getColumnCount(); i++) { prefuseSchemaTable.set(i, "Name", this.schema.getColumnName(i)); prefuseSchemaTable.set(i, "Type", this.schema.getColumnType(i)); prefuseSchemaTable.set(i, "Default Value", this.schema.getDefault(i)); } this.schemaTable = new PrefuseObviousTable(prefuseSchemaTable); }
/** * Sets a value. * @param rowId row to set * @param col to set * @param val to set */ public void set(int rowId, int col, Object val) { try { this.table.set(rowId, this.table.getSchema().getColumnName(col), val); this.fireTableEvent(rowId, rowId, col, TableListener.UPDATE); } catch (Exception e) { throw new ObviousRuntimeException(e); } }
/** * Sets a value. * @param rowId row to set * @param field field to set * @param val value to set */ public void set(int rowId, String field, Object val) { try { this.table.set(rowId, field, val); this.fireTableEvent(rowId, rowId, this.getSchema().getColumnIndex(field), TableListener.UPDATE); } catch (Exception e) { throw new ObviousRuntimeException(e); } }
for ( int i=0; i<s.getColumnCount(); ++i ) { String field = s.getColumnName(i); this.set(r, field, t.get(i));