/** * Get the out-degree of a node, the number of edges for which the node * is the source. * @param node the node id (node table row number) * @return the out-degree of the node */ public int getOutDegree(int node) { return m_links.getInt(node, OUTDEGREE); }
/** * Get the data value at the given field as an <code>int</code>. * @param field the data field to retrieve * @see #canGetInt(String) */ public final int getInt(String field) { return m_table.getInt(m_cur, field); }
/** * Get the in-degree of a node, the number of edges for which the node * is the target. * @param node the node id (node table row number) * @return the in-degree of the node */ public int getInDegree(int node) { return m_links.getInt(node, INDEGREE); }
/** * @see prefuse.data.Tuple#getInt(java.lang.String) */ public final int getInt(String field) { validityCheck(); return m_table.getInt(m_row, field); }
/** * @see prefuse.data.Tuple#getInt(int) */ public final int getInt(int col) { validityCheck(); return m_table.getInt(m_row, col); }
public Tuple getTuple(int row) { return m_backing.getEdge(m_table.getInt(row, SOURCE_EDGE)); } };
/** * Get the child index (order number of the child) for the given parent * node id and child node id. * @param parent the parent node id (node table row number) * @param child the child node id (node table row number) * @return the index of the child, or -1 if the given child node is not * actually a child of the given parent node, or either node is * invalud. */ public int getChildIndex(int parent, int child) { if ( getParent(child) != parent ) return -1; return m_links.getInt(child, CHILDINDEX); }
/** * Get the node id of the previous sibling of the given node id. * @param node a node id (node table row number) * @return the node id of the previous sibling, or -1 if there * is no previous sibling. */ public int getPreviousSiblingRow(int node) { int p = getParent(node); if ( p < 0 ) return -1; int[] links = (int[])m_links.get(p, OUTLINKS); int idx = m_links.getInt(node, CHILDINDEX); return ( idx<=0 ? -1 : getTargetNode(links[idx-1])); }
/** * Get an iterator over all AggregateItems that contain the given Tuple. * @param t the input tuple * @return an iterator over all AggregateItems that contain the input Tuple */ public Iterator getAggregates(Tuple t) { int hash = getHashCode(t); IntIterator iit = m_aggregated.getIndex(MEMBER_HASH).rows(hash); HashSet set = new HashSet(); while ( iit.hasNext() ) { int r = iit.nextInt(); set.add(getTuple(m_aggregated.getInt(r, AGGREGATE))); } return set.iterator(); }
/** * Get the row index to the aggregate mapping table for the given * aggregate and contained VisualItem. * @param row the table row of the aggregate * @param member the VisualItem to look up * @return the row index into the internal aggregate mapping table for the * mapping between the given aggregate row and given VisualItem */ protected int getAggregatedRow(int row, VisualItem member) { Index index = m_aggregated.index(MEMBER_HASH); int hash = getHashCode(member); int ar = index.get(hash); if ( ar < 0 ) { return -1; } else if ( m_aggregated.getInt(ar, AGGREGATE) == row ) { return ar; } else { for ( IntIterator rows = index.rows(hash); rows.hasNext(); ) { ar = rows.nextInt(); if ( m_aggregated.getInt(ar, AGGREGATE) == row ) return ar; } return -1; } }
/** * Get the node id of the next sibling of the given node id. * @param node a node id (node table row number) * @return the node id of the next sibling, or -1 if there * is no next sibling. */ public int getNextSiblingRow(int node) { int p = getParent(node); if ( p < 0 ) return -1; int[] links = (int[])m_links.get(p, OUTLINKS); int idx = m_links.getInt(node, CHILDINDEX); int max = getChildCount(p)-1; return ( idx<0 || idx>=max ? -1 : getTargetNode(links[idx+1])); }
/** * Internal method for updating the linkage of this graph. * @param e the edge id for the updated link * @param s the source node id for the updated link * @param t the target node id for the updated link * @param incr the increment value, 1 for an added link, * -1 for a removed link */ protected void updateDegrees(int e, int s, int t, int incr) { int od = m_links.getInt(s, OUTDEGREE); int id = m_links.getInt(t, INDEGREE); // update adjacency lists if ( incr > 0 ) { // add links addLink(OUTLINKS, od, s, e); addLink(INLINKS, id, t, e); } else if ( incr < 0 ) { // remove links remLink(OUTLINKS, od, s, e); remLink(INLINKS, id, t, e); } // update degree counts m_links.setInt(s, OUTDEGREE, od+incr); m_links.setInt(t, INDEGREE, id+incr); // link structure changed, invalidate spanning tree m_spanning = null; }
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)); } }
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, "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"));
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)); } }