Package prefuse.data.util

Examples of prefuse.data.util.Index


     * {@link prefuse.data.util.Index} class.
     * @return an iterator over a range of table rows, determined by a
     * sorted bounded range of a data field
     */
    public IntIterator rangeSortedBy(String field, double lo, double hi, int indexType) {
        Index index = getIndex(field, double.class, true);
        return index.rows(lo, hi, indexType);
    }
View Full Code Here


    public IntIterator rangeSortedBy(String field, Object lo, Object hi, int indexType) {
        Class type = TypeLib.getSharedType(lo, hi);
        // TODO: check this for correctness
        if ( type == null )
            throw new IllegalArgumentException("Incompatible arguments");
        Index index = getIndex(field, type, true);
        return index.rows(lo, hi, indexType);
    }
View Full Code Here

     * @return the row index of the minimum column value.
     */
    public int getMinimumRow() {
        accessCheck();
        if ( m_min == -1 && m_dynamic ) {
            Index idx = m_table.getIndex(m_field);
            if ( idx != null ) {
                m_min = idx.minimum();
            } else {
                m_min = DataLib.min(m_table.tuples(), m_field, m_cmp).getRow();
            }
        }
        return m_min;
View Full Code Here

     * @return the row index of the maximum column value.
     */
    public int getMaximumRow() {
        accessCheck();
        if ( m_max == -1 && m_dynamic ) {
            Index idx = m_table.getIndex(m_field);
            if ( idx != null ) {
                m_max = idx.maximum();
            } else {
                m_max = DataLib.max(m_table.tuples(), m_field, m_cmp).getRow();
            }
        }
        return m_max;
View Full Code Here

     * @return the row index of the median column value
     */
    public int getMedianRow() {
        accessCheck();
        if ( m_median == -1 && m_dynamic ) {
            Index idx = m_table.getIndex(m_field);
            if ( idx != null ) {
                m_max = idx.median();
            } else {
                m_median = DataLib.median(
                                m_table.tuples(), m_field, m_cmp).getRow();
            }
        }
View Full Code Here

     * @return the number of unique values in the column
     */
    public int getUniqueCount() {
        accessCheck();
        if ( m_unique == -1 && m_dynamic ) {
            Index idx = m_table.getIndex(m_field);
            if ( idx != null ) {
                m_unique = idx.uniqueCount();
            } else {
                m_unique = DataLib.uniqueCount(m_table.tuples(), m_field);
            }
        }
        return m_unique;
View Full Code Here

        Class type = t.getColumnType(keyField);
        if ( type == null )
            return -1;
       
        // get the index and perform the lookup
        Index index = t.index(keyField);
        if ( type == int.class ) {
            return index.get(rset.getInt(keyField));
        } else if ( type == long.class ) {
            return index.get(rset.getLong(keyField));
        } else if ( type == float.class ) {
            return index.get(rset.getFloat(keyField));
        } else if ( type == double.class ) {
            return index.get(rset.getDouble(keyField));
        } else if ( !type.isPrimitive() ) {
            return index.get(rset.getObject(keyField));
        } else {
            return -1;
        }
    }
View Full Code Here

     * optionally issuing a table update.
     * @param row the table row of the aggregate
     * @param update indicates whether or not to fire a table update
     */
    protected void clearAggregateMappings(int row, boolean update) {
        Index index = m_aggregated.index(AGGREGATE);
        boolean fire = false;
        for ( IntIterator rows = index.rows(row); rows.hasNext(); ) {
            int r = rows.nextInt();
            // this removal maneuver is ok because we know we are
            // pulling row values directly from an index
            // with intervening iterators, remove might throw an exception
            rows.remove();
View Full Code Here

     * @param member the VisualItem to look up
     * @return the row index into the internal aggregate mapping table for the
     * mapping between the given aggregate row and given VisualItem
     */
    protected int getAggregatedRow(int row, VisualItem member) {
        Index index = m_aggregated.index(MEMBER_HASH);
        int hash = getHashCode(member);
        int ar = index.get(hash);
        if ( ar < 0 ) {
            return -1;
        } else if ( m_aggregated.getInt(ar, AGGREGATE) == row ) {
            return ar;
        } else {
            for ( IntIterator rows = index.rows(hash); rows.hasNext(); ) {
                ar = rows.nextInt();
                if ( m_aggregated.getInt(ar, AGGREGATE) == row )
                    return ar;
            }
            return -1;
View Full Code Here

    protected class AggregatedIterator implements Iterator {
        private IntIterator m_rows;
        private Tuple m_next = null;

        public AggregatedIterator(int row) {
            Index index = m_aggregated.index(AGGREGATE);
            m_rows = index.rows(row);
            advance();
        }
View Full Code Here

TOP

Related Classes of prefuse.data.util.Index

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.