@SuppressWarnings("unchecked") @Override protected Index getIndex(String arg0, Class arg1, boolean arg2) { return super.getIndex(arg0, arg1, arg2); }
@Override public Index getIndex(String arg0) { return super.getIndex(arg0); }
/** * Return an iterator over a range of rwos in this table, determined * by a bounded range for a given data field. A new index over the * data field will be created if it doesn't already exist. * @param field the data field for determining the bounded range * @param lo the minimum range value * @param hi the maximum range value * @param indexType indicate the sort order and inclusivity/exclusivity * of the range bounds, using the constants of the * {@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, int lo, int hi, int indexType) { Index index = getIndex(field, int.class, true); return index.rows(lo, hi, indexType); }
/** * Internal method for index creation and retrieval. * @param field the data field name of the column * @param expType the expected data type of the index * @param create indicates whether or not a new index should be created * if none currently exists for the given data field * @return the Index for the given data field */ protected Index getIndex(String field, Class expType, boolean create) { if ( !expType.equals(getColumnType(field)) ) { // TODO: need more nuanced type checking here? throw new IllegalArgumentException("Column type does not match."); } if ( getIndex(field)==null && create) { index(field); } return getIndex(field); }
/** * Return an iterator over a range of rwos in this table, determined * by a bounded range for a given data field. A new index over the * data field will be created if it doesn't already exist. * @param field the data field for determining the bounded range * @param lo the minimum range value * @param hi the maximum range value * @param indexType indicate the sort order and inclusivity/exclusivity * of the range bounds, using the constants of the * {@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, long lo, long hi, int indexType) { Index index = getIndex(field, long.class, true); return index.rows(lo, hi, indexType); }
/** * Return an iterator over a range of rwos in this table, determined * by a bounded range for a given data field. A new index over the * data field will be created if it doesn't already exist. * @param field the data field for determining the bounded range * @param lo the minimum range value * @param hi the maximum range value * @param indexType indicate the sort order and inclusivity/exclusivity * of the range bounds, using the constants of the * {@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, float lo, float hi, int indexType) { Index index = getIndex(field, float.class, true); return index.rows(lo, hi, indexType); }
/** * Return an iterator over a range of rwos in this table, determined * by a bounded range for a given data field. A new index over the * data field will be created if it doesn't already exist. * @param field the data field for determining the bounded range * @param lo the minimum range value * @param hi the maximum range value * @param indexType indicate the sort order and inclusivity/exclusivity * of the range bounds, using the constants of the * {@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); }
protected static IntIterator getColumnIterator( Table t, String field, boolean val) { if ( t.getColumnType(field) != boolean.class ) return null; // only works for boolean-valued columns Index index = t.getIndex(field); if ( index == null ) { return null; } else { return index.rows(val); } }
/** * Get an iterator over the rows of this table, sorted by the given data * field. This method will create an index over the field if one does * not yet exist. * @param field the data field to sort by * @param ascend true if the iteration should proceed in an ascending * (lowest to highest) sort order, false for a descending order * @return the sorted iterator over rows of this table */ public IntIterator rowsSortedBy(String field, boolean ascend) { Class type = getColumnType(field); Index index = getIndex(field, type, true); int t = ascend ? Index.TYPE_ASCENDING : Index.TYPE_DESCENDING; return index.allRows(t); }
/** * Return an iterator over a range of rwos in this table, determined * by a bounded range for a given data field. A new index over the * data field will be created if it doesn't already exist. * @param field the data field for determining the bounded range * @param lo the minimum range value * @param hi the maximum range value * @param indexType indicate the sort order and inclusivity/exclusivity * of the range bounds, using the constants of the * {@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, 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); }
/** * Get an iterator over all AggregateItems that contain the given Tuple. * @param t the input tuple * @return an iterator over all AggregateItems that contain the input Tuple */ public Iterator getAggregates(Tuple t) { int hash = getHashCode(t); IntIterator iit = m_aggregated.getIndex(MEMBER_HASH).rows(hash); HashSet set = new HashSet(); while ( iit.hasNext() ) { int r = iit.nextInt(); set.add(getTuple(m_aggregated.getInt(r, AGGREGATE))); } return set.iterator(); }
/** * Get the number of unique values in the column. * @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; }
/** * Get the row index of the maximum column value. If there are multiple * maxima, only one is returned. * @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; }
/** * Get the row index of the median column value. * @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(); } } return m_median; }
/** * Get the row index of the minimum column value. If there are multiple * minima, only one is returned. * @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; }
m_longKey = true; nodes.index(nodeKey); m_nidx = nodes.getIndex(nodeKey);
Index index = t.getIndex(col.getColumnName());
Index index = t.getIndex(col.getColumnName());