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


Java Column类代码示例

本文整理汇总了Java中prefuse.data.column.Column的典型用法代码示例。如果您正苦于以下问题:Java Column类的具体用法?Java Column怎么用?Java Column使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initializeCountColumn

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Initialize the column with the counts of elements in them.
 * 
 * @param field
 *            the name of the dataColumn to histogrammize
 * @param dataColumn
 *            the column in the original (@link prefuse.data.Table)
 *            to be histogramized.
 */
private void initializeCountColumn( String field, Column dataColumn )
{
	int binSlot;
	int currentCount;  // separate var just for debugging ease
	String countField = getCountField( field );

	// initialize everything to 0 before starting to count
	for ( int binIndex = 0; binIndex < m_binCount; binIndex++ ) {
		set( binIndex, countField, 0 );
	}

	double dataColumnMin = m_binMin.get( field );
	double cellValue;
	for ( int dataRowIndex = 0; dataRowIndex < dataColumn.getRowCount(); dataRowIndex++ ) {
		cellValue = dataColumn.getDouble( dataRowIndex );
		binSlot = (int)( ( cellValue - dataColumnMin ) / m_binWidth );
		currentCount = getInt( binSlot, countField );
		setInt( binSlot, countField, currentCount + 1 );
	}
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:30,代码来源:HistogramTable.java

示例2: getNumericColumnMinMax

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * @param aColumn
 *            the column to get min/max of
 * @return min and max (in an array) of aColumn
 */
private double[] getNumericColumnMinMax( Column aColumn )
{
	double oldMin = aColumn.getDouble( 0 );
	double oldMax = oldMin;
	double[] minMax = new double[2];

	if ( aColumn.canGetDouble() ) {
		double currentValue;
		for ( int rowIndex = 1; rowIndex < aColumn.getRowCount(); rowIndex++ ) {
			currentValue = aColumn.getDouble( rowIndex );
			oldMin = Math.min( oldMin, currentValue );
			oldMax = Math.max( oldMax, currentValue );
		}
	}

	minMax[0] = oldMin;
	minMax[1] = oldMax;
	return minMax;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:25,代码来源:HistogramTable.java

示例3: columnChanged

import prefuse.data.column.Column; //导入依赖的package包/类
public void columnChanged(Column src, int idx, long prev) {
    if ( src==m_scol || src==m_tcol ) {
        boolean isSrc = src==m_scol;
        int e = m_edges.getTableRow(idx, isSrc?m_sidx:m_tidx);
        if ( e == -1 )
            return; // edge not in this graph
        int s = getSourceNode(e);
        int t = getTargetNode(e);
        int p = getNodeIndex(prev);
        if ( p > -1 && ((isSrc && t > -1) || (!isSrc && s > -1)) )
            updateDegrees(e, isSrc?p:s, isSrc?t:p, -1);
        if ( s > -1 && t > -1 )
            updateDegrees(e, s, t, 1);
    } else {
        throw new IllegalStateException();
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:Graph.java

示例4: removeRow

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Removes a row from this table.
 * @param row the row to delete
 * @return true if the row was successfully deleted, false if the
 * row was already invalid
 */
public boolean removeRow(int row) {
    if ( m_rows.isValidRow(row) ) {
        // the order of operations here is extremely important
        // otherwise listeners may end up with corrupted state.
        // fire update *BEFORE* clearing values
        // allow listeners (e.g., indices) to perform clean-up
        fireTableEvent(row, row, EventConstants.ALL_COLUMNS, 
        		EventConstants.DELETE);
        // invalidate the tuple
        m_tuples.invalidate(row);
        // release row with row manager
        // do this before clearing column values, so that any
        // listeners can determine that the row is invalid
        m_rows.releaseRow(row);
        // now clear column values
        for ( Iterator<Column> cols = getColumns(); cols.hasNext(); ) {
            Column c = cols.next();
            c.revertToDefault(row);
        }
        return true;
    }
    return false;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:30,代码来源:Table.java

示例5: removeColumn

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Internal method for removing a column.
 * @param idx the column number of the column to remove
 * @return the removed Column instance
 */
protected Column removeColumn(int idx) {
    // make sure index is legal
    if ( idx < 0 || idx >= m_columns.size() ) {
        throw new IllegalArgumentException("Column index is not legal.");
    }
    
    String name = m_names.get(idx);
    (m_entries.get(name)).dispose();
    Column col = m_columns.remove(idx);
    m_entries.remove(name);
    m_names.remove(idx);
    renumberColumns();
    
    m_lastCol = -1;
    invalidateSchema();
    
    // ignore what the old column has to say
    col.removeColumnListener(this);
    
    // fire notification
    fireTableEvent(m_rows.getMinimumRow(), m_rows.getMaximumRow(), 
                   idx, EventConstants.DELETE);
    
    return col;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:31,代码来源:Table.java

示例6: index

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Create (if necessary) and return an index over the given data field.
 * The first call to this method with a given field name will cause the
 * index to be created and stored. Subsequent calls will simply return
 * the stored index. To attempt to retrieve an index without triggering
 * creation of a new index, use the {@link #getIndex(String)} method.
 * @param field the data field name of the column to index
 * @return the index over the specified data column
 */
public Index index(String field) {
    ColumnEntry e = m_entries.get(field);
    if ( e == null ) {
        throw new IllegalArgumentException("Unknown column name: "+field);
    } else if ( e.index != null ) {
        return e.index; // already indexed
    }
    
    Column col = e.column;
    try {
        e.index = new TreeIndex(this, m_rows, col, null);
    } catch ( IncompatibleComparatorException ice ) { /* can't happen */ }
    
    return e.index;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:25,代码来源:Table.java

示例7: handleColumnChanged

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Handle a column change event.
 * @param c the modified column
 * @param start the starting row of the modified range
 * @param end the ending row (inclusive) of the modified range
 */
protected void handleColumnChanged(Column c, int start, int end) {
    for ( ; !isValidRow(start) && start <= end; ++start );
    if ( start > end ) return; // bail if no valid rows
    
    // determine the index of the updated column
    int idx;
    if ( m_lastCol != -1 && c == getColumn(m_lastCol) ) {
        // constant time
        idx = m_lastCol;
    } else {
        // linear time
        idx = getColumnNumber(c);
    }
    
    // if we have a valid index, fire a notification
    if ( idx >= 0 ) {
        fireTableEvent(start, end, idx, EventConstants.UPDATE);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:26,代码来源:Table.java

示例8: columnChanged

import prefuse.data.column.Column; //导入依赖的package包/类
public void columnChanged(Column src, int idx, long prev) {
	if (src == m_scol || src == m_tcol) {
		boolean isSrc = src == m_scol;
		int e = m_edges.getTableRow(idx, isSrc ? m_sidx : m_tidx);
		if (e == -1)
			return; // edge not in this graph
		int s = getSourceNode(e);
		int t = getTargetNode(e);
		int p = isSrc ? getNode1Index(prev) : getNode2Index(prev);
		if (p > -1 && ((isSrc && t > -1) || (!isSrc && s > -1)))
			updateDegrees(e, isSrc ? p : s, isSrc ? t : p, -1);
		if (s > -1 && t > -1)
			updateDegrees(e, s, t, 1);
	} else {
		throw new IllegalStateException();
	}
}
 
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:18,代码来源:BipartiteGraph.java

示例9: HistogramTable

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * @param aTable
 *            a Prefuse Table with data values (i.e. non-histogrammized) in it
 * @param aBinCount
 *            how many bins the data's range should be split into
 */
public HistogramTable( Table aTable, int aBinCount )
{
	super();

	if ( aBinCount <= 0 ) {
		throw new IllegalArgumentException( "Bin count must be a positive number." );
	}

	String[] fieldNames = getFieldNames( aTable );

	m_binCount = aBinCount;
	initializeHistogramTable( fieldNames, m_binCount );

	for ( int fieldIndex = 0; fieldIndex < fieldNames.length; fieldIndex++ ) {
		String field = fieldNames[fieldIndex];

		Column dataColumn = aTable.getColumn( field );
		if ( dataColumn == null ) {
			throw new NullPointerException( "Column not found for field " + field );
		}

		if ( dataColumn.canGetDouble() ) {
			initializeNumericColumn( field, dataColumn );
		}
		else if ( dataColumn.canGetString() ) {
			initializeStringColumn( field, dataColumn );
		}
		else {
			// Can't really histogrammize any other data in a sensible way, ignore it *shrug*
			continue;
		}
	}
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:40,代码来源:HistogramTable.java

示例10: initializeNumericColumn

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * @param field
 *            the name of the dataColumn to histogrammize
 * @param dataColumn
 *            the dataColumn to histogrammize
 */
private void initializeNumericColumn( String field, Column dataColumn )
{
	addColumn( field, double.class );
	getColumn( field ).setParser( new DoubleParser() );
	String countField = getCountField( field );

	addColumn( countField, int.class );
	getColumn( countField ).setParser( new IntParser() );

	initializeNumericBinInfo( field, dataColumn );
	initializeNumericBinColumn( field );
	initializeCountColumn( field, dataColumn );
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:20,代码来源:HistogramTable.java

示例11: initializeNumericBinInfo

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * @param field
 *            the name of the dataColumn to histogrammize
 * @param dataColumn
 *            the dataColumn to histogrammize
 */
private void initializeNumericBinInfo( String field, Column dataColumn )
{
	double[] minMax = new double[2];
	minMax = getNumericColumnMinMax( dataColumn );
	double minValue = minMax[0];
	double maxValue = minMax[1];

	m_binMax.put( field, maxValue );
	m_binMin.put( field, minValue );

	m_binWidth = ( 1 + maxValue - minValue ) / m_binCount;

	assert m_binWidth >= 0.0 : "m_binWidth < 0!";
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:21,代码来源:HistogramTable.java

示例12: getColumnNumber

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * @see prefuse.data.Table#getColumnNumber(prefuse.data.column.Column)
 */
public int getColumnNumber(Column col) {
    int idx = m_columns.indexOf(col);
    if ( idx == -1 && m_parent != null ) {
        idx = m_parent.getColumnNumber(col);
        if ( idx == -1 ) return idx;
        String name = m_parent.getColumnName(idx);
        idx = m_pnames.indexOf(name);
        if ( idx != -1 ) idx += m_columns.size();
    }
    return idx;
 }
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:15,代码来源:CascadedTable.java

示例13: getColumn

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * @see prefuse.data.Table#getColumn(int)
 */
public Column getColumn(int col) {
    m_lastCol = col;
    int local = m_names.size();
    if ( col >= local && m_parent != null ) {
        return m_parent.getColumn((String)m_pnames.get(col-local));
    } else {
        return (Column)m_columns.get(col);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:13,代码来源:CascadedTable.java

示例14: Table

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Create a new Table.
 * @param nrows the starting number of table rows
 * @param ncols the starting capacity for columns 
 * @param tupleType the class of the Tuple instances to use
 */
protected Table(int nrows, int ncols, Class tupleType) {
    m_listeners = new CopyOnWriteArrayList<TableListener>();
    m_columns = new ArrayList<Column>(ncols);
    m_names = new ArrayList<String>(ncols);
    m_rows = new RowManager(this);
    m_entries = new HashMap<String, ColumnEntry>(ncols+5);        
    m_tuples = new TupleManager(this, null, tupleType);

    if ( nrows > 0 )
        addRows(nrows);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:Table.java

示例15: updateRowCount

import prefuse.data.column.Column; //导入依赖的package包/类
/**
 * Internal method that updates the row counts for local data columns.
 */
protected void updateRowCount() {
    int maxrow = m_rows.getMaximumRow() + 1;
    
    // update columns
    Iterator<Column> cols = getColumns();
    while ( cols.hasNext() ) {
        Column c = cols.next();
        c.setMaximumRow(maxrow);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:14,代码来源:Table.java


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