コード例 #1
0
 /**
  * Returns the object at row # row
  *
  * @param row the row number
  * @return the object at row # row. if no such object exists - returns null.
  */
 public Object getObject(int row) {
   if (elements.containsKey(row)) {
     return elements.get(row);
   } else {
     return SparseDefaultValues.getDefaultObject();
   }
 }
コード例 #2
0
  /**
   * 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;
  }