/** * Add a column with the given name and data type to this table. * @param name the data field name for the column * @param type the data type, as a Java Class, for the column * @see prefuse.data.tuple.TupleSet#addColumn(java.lang.String, java.lang.Class) */ public void addColumn(String name, Class type) { addColumn(name, type, null); }
public MapReduceSwimlanes() { this.plot_tab = new Table(); this.plot_tab.addColumn("ycoord",float.class); this.plot_tab.addColumn("state_name",String.class); this.plot_tab.addColumn("hostname",String.class); this.plot_tab.addColumn("friendly_id",String.class); this.plot_tab.addColumn(START_FIELD_NAME,double.class); this.plot_tab.addColumn(END_FIELD_NAME,double.class); this.plot_tab.addColumn(PolygonRenderer.POLYGON,float[].class); this.reducepart_hash = new HashMap<String, ArrayList<Tuple> >(); }
/** * Instantiate this schema as a new Table instance. * @param nrows the number of starting rows in the table * @return a new Table with this schema */ public Table instantiate(int nrows) { Table t = new Table(nrows, m_size); for ( int i=0; i<m_size; ++i ) { t.addColumn(m_names[i], m_types[i], m_dflts[i]); } return t; }
/** * Add a constant column to this table, which returns one constant value * for all column rows. * @param name the data field name for the column * @param type the data type, as a Java Class, for the column * @param dflt the default value for column data values */ public void addConstantColumn(String name, Class type, Object dflt) { addColumn(name, ColumnFactory.getConstantColumn(type, dflt)); }
/** * Add a derived column to this table, using an Expression instance to * dynamically calculate the column data values. * @param name the data field name for the column * @param expr the Expression that will determine the column values * @see prefuse.data.tuple.TupleSet#addColumn(java.lang.String, prefuse.data.expression.Expression) */ public void addColumn(String name, Expression expr) { addColumn(name, ColumnFactory.getColumn(this, expr)); }
/* package */ GraphBuilder() { graph = new Graph( true ); Table nodeTable = graph.getNodeTable(); nodeTable.addColumn( GraphDisplay.NAME_LABEL, String.class ); nodeTable.addColumn( GraphDisplay.USER_OBJECT, Object.class ); Table edgeTable = graph.getEdgeTable(); edgeTable.addColumn( GraphDisplay.USES_EDGES, boolean.class, false ); childList = new ArrayList(); }
/** * Create a new Graph using the provided table of node data and * an empty set of edges. * @param nodes the backing table to use for node data. * Node instances of this graph will get their data from this table. * @param directed true for directed edges, false for undirected * @param nodeKey data field used to uniquely identify a node. If this * field is null, the node table row numbers will be used * @param sourceKey data field used to denote the source node in an edge * table * @param targetKey data field used to denote the target node in an edge * table */ public Graph(Table nodes, boolean directed, String nodeKey, String sourceKey, String targetKey) { Table edges = new Table(); edges.addColumn(sourceKey, int.class, new Integer(-1)); edges.addColumn(targetKey, int.class, new Integer(-1)); init(nodes, edges, directed, nodeKey, sourceKey, targetKey); }
/** * Add a column with the given name and data type to this table. * @param name the data field name for the column * @param type the data type, as a Java Class, for the column * @param defaultValue the default value for column data values * @see prefuse.data.tuple.TupleSet#addColumn(java.lang.String, java.lang.Class, java.lang.Object) */ public void addColumn(String name, Class type, Object defaultValue) { Column col = ColumnFactory.getColumn(type, m_rows.getMaximumRow()+1, defaultValue); addColumn(name, col); }
/** * Add a derived column to this table, using an Expression instance to * dynamically calculate the column data values. * @param name the data field name for the column * @param expr a String expression in the prefuse expression language, to * be parsed into an {@link prefuse.data.expression.Expression} instance. * The string is parsed by the * {@link prefuse.data.expression.parser.ExpressionParser}. If an error * occurs during parsing, an exception will be thrown. * @see prefuse.data.tuple.TupleSet#addColumn(java.lang.String, java.lang.String) */ public void addColumn(String name, String expr) { Expression ex = ExpressionParser.parse(expr); Throwable t = ExpressionParser.getError(); if ( t != null ) { throw new RuntimeException(t); } else { addColumn(name, ex); } }
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { if ( qName.equals(DECL) ) { if ( !m_inSchema ) { throw new RuntimeException("All declarations must be done " + "before nodes begin"); } String name = atts.getValue(NAME); String type = atts.getValue(TYPE); Class t = parseType(type); m_nodes.addColumn(name, t); } else if ( qName.equals(BRANCH) || qName.equals(LEAF) ) { schemaCheck(); // parse a node element Node n; if ( m_activeNode == null ) { n = m_tree.addRoot(); } else { n = m_tree.addChild(m_activeNode); } m_activeNode = n; } else if ( qName.equals(ATTR) ) { // parse an attribute parseAttribute(atts); } }
protected Table setupDataTable() { Table res_tab = this.getData(); if (res_tab == null) { return res_tab; } res_tab.addColumn("seqno","ROW()"); res_tab = addTimeOffsetCol(res_tab, "start_time", "start_time_millis", START_FIELD_NAME, 0); ColumnMetadata dstcol = res_tab.getMetadata(START_FIELD_NAME); long mintime = ((Timestamp)res_tab.get(dstcol.getMinimumRow(), "start_time")).getTime(); res_tab = addTimeOffsetCol(res_tab, "finish_time", "finish_time_millis", END_FIELD_NAME, mintime); res_tab.addColumn(PolygonRenderer.POLYGON,float[].class); log.debug("After adding seqno: #cols: " + res_tab.getColumnCount() + "; #rows: " + res_tab.getRowCount()); return res_tab; }
/** * 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); }
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)); }
/** * Constructor that used Obvious Schema to wrap Prefuse Tables. * @param schema original obvious schema for the table */ public PrefuseObviousTable(Schema schema) { this.table = new prefuse.data.Table(0, schema.getColumnCount()); this.listener = new ArrayList<TableListener>(); for (int i = 0; i < schema.getColumnCount(); i++) { this.table.addColumn(schema.getColumnName(i), schema.getColumnType(i), schema.getColumnDefault(i)); } }
/** * Adds a column to given table by converting timestamp to long with * seconds since epoch, and adding milliseconds from additional column * in original table * * @param origTable Table to add to * @param srcFieldName Name of column containing timestamp * @param srcMillisecondFieldName Name of column containing millisecond value of time * @param dstFieldName Name of new column to add * * @return Modified table with added column */ protected Table addTimeCol (Table origTable, String srcFieldName, String srcMillisecondFieldName, String dstFieldName) { origTable.addColumn(dstFieldName, long.class); int total_rows = origTable.getRowCount(); for (int curr_row_num = 0; curr_row_num < total_rows; curr_row_num++) { origTable.setLong(curr_row_num, dstFieldName, ((Timestamp)origTable.get(curr_row_num, srcFieldName)).getTime() + origTable.getLong(curr_row_num, srcMillisecondFieldName) ); } return origTable; }
protected void addHostLabels(HeatmapData hd) { Table legend_labels_table = new Table(); legend_labels_table.addColumn("label",String.class); legend_labels_table.addRows(hd.hostnames.length); for (int i = 0; i < hd.hostnames.length; i++) { legend_labels_table.setString(i,"label",hd.hostnames[i]); } float start_x = LEGEND_X_OFFSET; float start_y = LEGEND_Y_OFFSET + BORDER[1] + (BOXWIDTH/2); float incr = this.BOXWIDTH; VisualTable legend_labels_table_viz = this.viz.addTable(legendgroup, legend_labels_table); for (int i = 0; i < hd.hostnames.length; i++) { legend_labels_table_viz.setFloat(i, VisualItem.X, start_x + LEGEND_TEXT_OFFSET); legend_labels_table_viz.setFloat(i, VisualItem.Y, start_y + (i * incr)); legend_labels_table_viz.setTextColor(i,ColorLib.color(java.awt.Color.BLACK)); legend_labels_table_viz.setFont(i,new Font(Font.SANS_SERIF,Font.PLAIN,LEGEND_FONT_SIZE)); } }
header = getDefaultHeader(i); table.addColumn(header, di.getType(i)); table.getColumn(i).setParser(di.getParser(i));
protected void addAddlInfo(HeatmapData hd) { Table legend_labels_table = new Table(); legend_labels_table.addColumn("label",String.class); legend_labels_table.addRows(3);