本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}