/** * Returns a SparseObjectColumn that holds only the data from rows <code> * pos</code> through <code>pos+len</code> * * @param pos the row number which is the beginning of the subset * @param len number of consequetive rows after <code>pos</code> that are to be included in the * subset. * @return a SparseObjectColumn with the data from rows <code>pos</code> through <code>pos+len * </code> */ public Column getSubset(int pos, int len) { SparseObjectColumn subCol = new SparseObjectColumn(); subCol.elements = (VIntObjectHashMap) elements.getSubset(pos, len); getSubset(subCol, pos, len); return subCol; /* //the map to hold the data of the subset VIntObjectHashMap tempMap = new VIntObjectHashMap(len); //for each Object from pos till pos+len for (int i=0; i<len; i++) //if a value is mapped to current inspected row number if(elements.containsKey(pos+i)) //put it in the new map tempMap.put(pos+i, getObject(pos+i)); SparseObjectColumn subCol = new SparseObjectColumn(); //the returned value super.copy(subCol); //copying general attributes //activating copy method in order to have a deep copy of the subset subCol.elements = tempMap.copy(); //linking the data to the returned value return subCol; */ }
/** * Reorders the data stored in this column in a new column. Does not change this column. * * <p>Algorithm: copy this column into the returned vlaue. for each pair (key, val) in <code> * newOrder</code>, if val is a valid row in this column, put the value mapped to it in row no. * key in the returned values. * * @param newOrder - an int to int hashmap, defining the new order for the returned column. * @return a SparseObjectColumn ordered according to <code>newOrder</code>. */ public Column reorderRows(VIntIntHashMap newOrder) { SparseObjectColumn retVal = new SparseObjectColumn(); retVal.elements = (VIntObjectHashMap) elements.reorder(newOrder); reorderRows(retVal, newOrder); return retVal; }