Package prefuse.data

Examples of prefuse.data.Table$ColumnEntry


   */
  public static Table standardizeTable(URL propertiesFilePath, Table inputTable) throws IOException {
    if (propertiesFilePath == null || inputTable == null)
      throw new IllegalArgumentException();
   
    Table returnTable = new Table();
   
    // grabs info about inputData
    Schema oldSchema = inputTable.getSchema();   
    final int numTableColumns = oldSchema.getColumnCount();
    final int numTableRows = inputTable.getRowCount();
   
    Map<String, String> headerMap = readHeaderProperties(propertiesFilePath);
   
    // add columns to return table, correcting them as iteration proceeds
    for (int i = 0; i < numTableColumns; i++) {
      String colHead = oldSchema.getColumnName(i);
     
      // check for columns that need updating here
      String newHeader = headerMap.get(colHead);
      if (newHeader != null)
        colHead = newHeader;
     
      returnTable.addColumn(colHead, oldSchema.getColumnType(i));
    }
   
    // add existing rows to return table
    returnTable.addRows(numTableRows);
    for (int i = 0; i < numTableRows; i++) {
      copyTableRow(i, i, returnTable, inputTable);
    }
     
    return returnTable;
View Full Code Here


    }
    return columnNames;
  }
   
  public static Table copyTable(Table t) {
    Table tCopy = new Table();
    tCopy.addColumns(t.getSchema());
   
    for (Iterator ii = t.tuples(); ii.hasNext();) {
      Tuple tuple = (Tuple) ii.next();
      tCopy.addTuple(tuple);
    }
    return tCopy;
  }
View Full Code Here

      if (t.getColumn(columnName) == null) {
        System.out.println("WTF, cannot find column " + columnName);
      }
    }
    Sort tSort = new Sort(columnNames);
    Table sortedTable = t.select(ExpressionParser.predicate("TRUE"),
        tSort);
    return sortedTable;
  }
View Full Code Here

     * other. The default methods instead appear to be doing a memory
     * location comparison.
     */

    private boolean areEqual(Graph g1, Graph g2, boolean sort) {
      Table nodeTable1 = g1.getNodeTable();
      Table nodeTable2 = g2.getNodeTable();
     
      if (sort) {
        if (! areEqualWhenSorted(nodeTable1, nodeTable2))
          return false;
      } else {
        if (! areEqual(nodeTable1, nodeTable2))
          return false;
      }
     
      Table edgeTable1 = g1.getEdgeTable();
      Table edgeTable2 = g2.getEdgeTable();
     
      if (sort) {
        if (! areEqualWhenSorted(edgeTable1, edgeTable2))
          return false;
      } else {
View Full Code Here

   
    /*
     * TODO: (might want to shortcut all of this by counting from 0 to
     * numberOfNodes)
     */
    Table nodeTable = g.getNodeTable();
    for (IntIterator ii = nodeTable.rows(); ii.hasNext();) {
      int nodeID = ii.nextInt();
      Node node = g.getNode(nodeID);
     
      int numEdges = g.getInDegree(node) + g.getOutDegree(node);
     
View Full Code Here

    return nodeFrequencyPairs;
  }

 
  private boolean haveSameNodeAttributes(Graph g1, Graph g2) {
    Table t1 = getStrippedNodeTable(g1);
    Table t2 = getStrippedNodeTable(g2);
    boolean result = areEqualWhenSorted(t1, t2);
    return result;
  }
View Full Code Here

   * for source and target IDs, or the order the edgesappear in the edge
   * tables.
   */
  private boolean haveSameEdgeAttributes(Graph g1, Graph g2) {
    //remove the IDs
    Table t1 = getStrippedEdgeTable(g1.getEdgeTable());
    Table t2 = getStrippedEdgeTable(g2.getEdgeTable());
       
    boolean result = areEqualWhenSorted(t1, t2);
    return result;
  }
View Full Code Here

   * other. The default methods instead appear to be doing a memory
   * location comparison.
   */

  private boolean areEqual(Graph g1, Graph g2, boolean sort) {
    Table nodeTable1 = g1.getNodeTable();
    Table nodeTable2 = g2.getNodeTable();
   
    if (sort) {
      if (! areEqualWhenSorted(nodeTable1, nodeTable2))
        return false;
    } else {
      if (! areEqual(nodeTable1, nodeTable2))
        return false;
    }
   
    Table edgeTable1 = g1.getEdgeTable();
    Table edgeTable2 = g2.getEdgeTable();
   
    if (sort) {
      if (! areEqualWhenSorted(edgeTable1, edgeTable2))
        return false;
    } else {
View Full Code Here

   *
   * @param t the original table
   * @return a stripped copy of the original table
   */
  private Table getStrippedEdgeTable(Table t) {
    Table tCopy = TableUtil.copyTable(t);
    tCopy.removeColumn(Graph.DEFAULT_SOURCE_KEY);
    tCopy.removeColumn(Graph.DEFAULT_TARGET_KEY);
    return tCopy;
  }
View Full Code Here

    tCopy.removeColumn(Graph.DEFAULT_TARGET_KEY);
    return tCopy;
  }
 
  private Table getStrippedNodeTable(Graph g) {
    Table tCopy = TableUtil.copyTable(g.getNodeTable());
    String nodeKeyField = g.getNodeKeyField();
    if (nodeKeyField != null) {
      tCopy.removeColumn(nodeKeyField);
    }
    return tCopy;
 
View Full Code Here

TOP

Related Classes of prefuse.data.Table$ColumnEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.