当前位置: 首页>>代码示例>>Java>>正文


Java Table.rows方法代码示例

本文整理汇总了Java中prefuse.data.Table.rows方法的典型用法代码示例。如果您正苦于以下问题:Java Table.rows方法的具体用法?Java Table.rows怎么用?Java Table.rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在prefuse.data.Table的用法示例。


在下文中一共展示了Table.rows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rows

import prefuse.data.Table; //导入方法依赖的package包/类
/**
 * Get a filtered iterator over the rows in the given table,
 * filtered by the given predicate.
 * @param t the Table to iterate over
 * @param p the filter predicate
 * @return a filtered iterator over the table rows
 */
public static IntIterator rows(Table t, Predicate p) {
    // attempt to generate an optimized query plan
    IntIterator iter = null;
    iter = getOptimizedIterator(t, p);
    
    // optimization fails, scan the entire table
    if ( iter == null ) {
        iter = new FilterRowIterator(t.rows(), t, p);
    }
    return iter;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:19,代码来源:FilterIteratorFactory.java

示例2: writeTable

import prefuse.data.Table; //导入方法依赖的package包/类
/**
 * @see prefuse.data.io.TableWriter#writeTable(prefuse.data.Table, java.io.OutputStream)
 */
public void writeTable(Table table, OutputStream os) throws DataIOException {
    try {            
        // get print stream
        PrintStream out = new PrintStream(new BufferedOutputStream(os));
        
        // write out header row
        if ( m_printHeader ) {
            for ( int i=0; i<table.getColumnCount(); ++i ) {
                if ( i>0 ) out.print(m_delim);
                out.print(table.getColumnName(i));
            }
            out.println();
        }
        
        // write out data
        for ( IntIterator rows = table.rows(); rows.hasNext(); ) {
            int row = rows.nextInt();
            for ( int i=0; i<table.getColumnCount(); ++i ) {
                if ( i>0 ) out.print(m_delim);
                out.print(table.getString(row, table.getColumnName(i)));
            }
            out.println();
        }
        
        // finish up
        out.flush();
    } catch ( Exception e ) {
        throw new DataIOException(e);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:34,代码来源:DelimitedTextTableWriter.java

示例3: writeTable

import prefuse.data.Table; //导入方法依赖的package包/类
/**
 * @see prefuse.data.io.TableWriter#writeTable(prefuse.data.Table, java.io.OutputStream)
 */
public void writeTable(Table table, OutputStream os) throws DataIOException {
    try {            
        // get print stream
        PrintStream out = new PrintStream(new BufferedOutputStream(os));
        
        // write out header row
        if ( m_printHeader ) {
            for ( int i=0; i<table.getColumnCount(); ++i ) {
                if ( i>0 ) out.print(',');
                out.print(makeCSVSafe(table.getColumnName(i)));
            }
            out.println();
        }
        
        // write out data
        for ( IntIterator rows = table.rows(); rows.hasNext(); ) {
            int row = rows.nextInt();
            for ( int i=0; i<table.getColumnCount(); ++i ) {
                if ( i>0 ) out.print(',');
                String str = table.getString(row, table.getColumnName(i));
                out.print(makeCSVSafe(str));
            }
            out.println();
        }
        
        // finish up
        out.flush();
    } catch ( Exception e ) {
        throw new DataIOException(e);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:35,代码来源:CSVTableWriter.java

示例4: writeTable

import prefuse.data.Table; //导入方法依赖的package包/类
/**
    * @see prefuse.data.io.TableWriter#writeTable(prefuse.data.Table, java.io.OutputStream)
    */
   @SuppressWarnings("rawtypes")
public void writeTable(Table table, OutputStream os) throws DataIOException {
       try {            
           // get print stream
           PrintStream out = new PrintStream(new BufferedOutputStream(os));
           
           // build array of column padding
           char[] pad = new char[table.getColumnCount()];
           boolean[] pre = new boolean[table.getColumnCount()];
           for (int i=0; i<table.getColumnCount(); ++i ) {
           	Class type = table.getColumnType(i);
           	pre[i] = TypeLib.isNumericType(type);
           	pad[i] = pre[i] ? '0' : ' ';
           }
           
           // write out data
           for ( IntIterator rows = table.rows(); rows.hasNext(); ) {
               int row = rows.nextInt();
               for ( int i=0; i<table.getColumnCount(); ++i ) {
               	out.print(pack(table.getString(row, i), 
               				   m_schema.getColumnLength(i),
               				   pre[i], pad[i]));
               }
               out.println();
           }
           
           // finish up
           out.flush();
       } catch ( Exception e ) {
           throw new DataIOException(e);
       }
   }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:36,代码来源:FixedWidthTextTableWriter.java


注:本文中的prefuse.data.Table.rows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。