本文整理汇总了Java中prefuse.data.Table.getColumnCount方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getColumnCount方法的具体用法?Java Table.getColumnCount怎么用?Java Table.getColumnCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.Table
的用法示例。
在下文中一共展示了Table.getColumnCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例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(',');
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);
}
}
示例3: 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);
}
}
示例4: tableToString
import prefuse.data.Table; //导入方法依赖的package包/类
String tableToString(Table table)
{
StringBuilder strb = new StringBuilder();
for(int row = 0; row < table.getRowCount(); row++)
{
for(int col = 0; col < table.getColumnCount(); col++)
{
strb.append(table.get(row, col));
strb.append(" ");
}
strb.append("\n");
}
return strb.toString();
}
示例5: getFieldNames
import prefuse.data.Table; //导入方法依赖的package包/类
/**
* @param aTable
* a HistogramTable or Prefuse Table
* @return fieldNames a list of the names of the columns in the table.
* Note that a HistogramTable will have all the same column names as
* are in its (Prefuse Table) data table's, but will also have an additional
* set of columns that have the counts. See getCountField().
* TODO It might be interesting to have a method getNonCountFieldNames which
* strips out the count fields.
*/
public static String[] getFieldNames( Table aTable )
{
int columnCount = aTable.getColumnCount();
String[] fieldNames = new String[columnCount];
for ( int columnIndex = 0; columnIndex < columnCount; columnIndex++ ) {
fieldNames[columnIndex] = aTable.getColumnName( columnIndex );
}
return fieldNames;
}