/**
  * Swaps the values between 2 rows. If there is no data in row #<code>pos1</code> then nothing is
  * stored in row #<ocde>pos2</code>, and vice versia.
  *
  * @param pos1 - the row number of first item to be swaped
  * @param pos2 - the row number of second item to be swaped
  */
 public void swapRows(int pos1, int pos2) {
   if (pos1 == pos2) {
     return;
   }
   Object obj1 = elements.remove(pos1);
   Object obj2 = elements.remove(pos2);
   if (obj1 != null) {
     setObject(obj1, pos2);
   }
   if (obj2 != null) {
     setObject(obj2, pos1);
   }
   missing.swapRows(pos1, pos2);
   empty.swapRows(pos1, pos2);
 }
 /**
  * constrcut a new SparseObjectColumn. each value data[i] is set to validRows[i]. if validRows is
  * smaller than data, the rest of the values in data are being inserted to the end of this column
  *
  * @param data an Object array that holds the values to be inserted into this column
  * @param validRows the indices to be valid in this column
  */
 public SparseObjectColumn(Object[] data, int[] validRows) {
   this(data.length);
   int i;
   for (i = 0; i < data.length && i < validRows.length; i++) {
     setObject(data[i], validRows[i]);
   }
   for (; i < data.length; i++) {
     addRow(data[i]);
   }
 }
  /**
   * 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;
  }
 /**
  * Set the value at pos to be newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setChars(char[] newEntry, int pos) {
   setObject(newEntry, pos);
 }
 /**
  * Set the value at pos to be newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setBytes(byte[] newEntry, int pos) {
   setObject(newEntry, pos);
 }
 /**
  * Set the value at pos to be newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setString(String newEntry, int pos) {
   setObject(newEntry, pos);
 }
 /**
  * Set the item at pos to be a Short object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setShort(short newEntry, int pos) {
   setObject(new Short(newEntry), pos);
 }
 /**
  * Set the item at pos to be an Integer object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setInt(int newEntry, int pos) {
   setObject(new Integer(newEntry), pos);
 }
 /**
  * Set the item at pos to be a Long object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setLong(long newEntry, int pos) {
   setObject(new Long(newEntry), pos);
 }
 /**
  * Set the item at pos to be a Float object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setFloat(float newEntry, int pos) {
   setObject(new Float(newEntry), pos);
 }
 /**
  * Set the item at pos to be a Double object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setDouble(double newEntry, int pos) {
   setObject(new Double(newEntry), pos);
 }
 /**
  * Set the item at pos to be a Character object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setChar(char newEntry, int pos) {
   setObject(new Character(newEntry), pos);
 }
 /**
  * Set the item at pos to be a Byte object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setByte(byte newEntry, int pos) {
   setObject(new Byte(newEntry), pos);
 }
 /**
  * Set the item at pos to be a Bollean object encapsulating newEntry.
  *
  * @param newEntry the new item
  * @param pos the position
  */
 public void setBoolean(boolean newEntry, int pos) {
   setObject(new Boolean(newEntry), pos);
 }