/** * returns a subset of this column with entried from rows indicated by <code>indices</code>. * * @param indices row numbers to include in the returned subset. * @return a subset of this column, including rows indicated by <code>indices</code>. */ public Column getSubset(int[] indices) { SparseObjectColumn retVal = new SparseObjectColumn(indices.length); for (int i = 0; i < indices.length; i++) { if (elements.containsKey(indices[i])) { // XIAOLEI // retVal.setObject(getObject(indices[i]), indices[i]); retVal.setObject(getObject(indices[i]), i); } } super.getSubset(retVal, indices); return retVal; }
/** * Inserts a new entry in the Column at position <code>pos</code>. All entries at row numbers * greater than <codE>pos</code> are moved down the column to the next row. * * @param newEntry the newEntry to insert * @param pos the position to insert at */ public void insertRow(Object newEntry, int pos) { switch (getType()) { case ColumnTypes.BYTE_ARRAY: newEntry = SparseByteArrayColumn.toByteArray(newEntry); break; case ColumnTypes.CHAR_ARRAY: newEntry = SparseCharArrayColumn.toCharArray(newEntry); break; case ColumnTypes.STRING: newEntry = SparseStringColumn.toStringObject(newEntry); break; } super.insertRow(newEntry, pos); }
public void copy(AbstractSparseColumn srcCol) { if (srcCol instanceof SparseObjectColumn) { elements = (VIntObjectHashMap) ((SparseObjectColumn) srcCol).elements.copy(); } super.copy(srcCol); }